Commit d3bdfa2c authored by iggy@recycle.(none)'s avatar iggy@recycle.(none)

Bug#25222 Win32 HANDLE leak in my_sopen()

- When attempting to associate a Windows File handle to a C run-time file
handle there is an upper bound.  Once reached, the newly created handles
will cause a memory leak since they are not properly associated with a
handle that can later be cleaned up.
parent 3b403236
......@@ -345,7 +345,12 @@ File my_sopen(const char *path, int oflag, int shflag, int pmode)
return -1; /* return error to caller */
}
fh= _open_osfhandle((intptr_t)osfh, oflag & (_O_APPEND | _O_RDONLY | _O_TEXT));
if ((fh= _open_osfhandle((intptr_t)osfh,
oflag & (_O_APPEND | _O_RDONLY | _O_TEXT))) == -1)
{
_dosmaperr(GetLastError()); /* map error */
CloseHandle(osfh);
}
return fh; /* return handle */
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment