diff options
author | iggy@recycle.(none) <> | 2007-03-07 10:46:38 -0500 |
---|---|---|
committer | iggy@recycle.(none) <> | 2007-03-07 10:46:38 -0500 |
commit | d3bdfa2c3063edcd0e8c99fb37baab07fa149d65 (patch) | |
tree | 644153cb4f398e81dfece84a04ff0c98ae305e74 /mysys | |
parent | 3b4032362bf46ac7408b560cde5c088c8b7d17df (diff) | |
download | mariadb-git-d3bdfa2c3063edcd0e8c99fb37baab07fa149d65.tar.gz |
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.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_open.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mysys/my_open.c b/mysys/my_open.c index 2ba84f92ac2..9e1da1d3f07 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -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 */ } |