Commit 83def161 authored by unknown's avatar unknown

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.


mysys/my_open.c:
  Bug#25222 Win32 HANDLE leak in my_sopen()
  - Check for failure in _open_osfhandle and close allocated HANDLE on failure.
parent c4390d05
......@@ -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