Cygwin: fhandler_pipe::raw_read: fix handle leak
Slightly rearrange code to avoid returning without closing the event handle.
This commit is contained in:
parent
61867cac3b
commit
384c78e8a7
|
@ -284,13 +284,6 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
|
||||||
if (!len)
|
if (!len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(evt = CreateEvent (NULL, false, false, NULL)))
|
|
||||||
{
|
|
||||||
__seterrno ();
|
|
||||||
len = (size_t) -1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD timeout = is_nonblocking () ? 0 : INFINITE;
|
DWORD timeout = is_nonblocking () ? 0 : INFINITE;
|
||||||
DWORD waitret = cygwait (read_mtx, timeout);
|
DWORD waitret = cygwait (read_mtx, timeout);
|
||||||
switch (waitret)
|
switch (waitret)
|
||||||
|
@ -314,6 +307,15 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
|
||||||
len = (size_t) -1;
|
len = (size_t) -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(evt = CreateEvent (NULL, false, false, NULL)))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
len = (size_t) -1;
|
||||||
|
ReleaseMutex (read_mtx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (nbytes < len)
|
while (nbytes < len)
|
||||||
{
|
{
|
||||||
ULONG_PTR nbytes_now = 0;
|
ULONG_PTR nbytes_now = 0;
|
||||||
|
|
Loading…
Reference in New Issue