summaryrefslogtreecommitdiff
path: root/mysys/my_open.c
diff options
context:
space:
mode:
authorunknown <iggy@recycle.(none)>2007-03-07 10:46:38 -0500
committerunknown <iggy@recycle.(none)>2007-03-07 10:46:38 -0500
commit83def161de98f4eaaccf6c83b71644ef44cc384d (patch)
tree644153cb4f398e81dfece84a04ff0c98ae305e74 /mysys/my_open.c
parentc4390d0519ecf686b560df1a2d59cc5371e00da9 (diff)
downloadmariadb-git-83def161de98f4eaaccf6c83b71644ef44cc384d.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. mysys/my_open.c: Bug#25222 Win32 HANDLE leak in my_sopen() - Check for failure in _open_osfhandle and close allocated HANDLE on failure.
Diffstat (limited to 'mysys/my_open.c')
-rw-r--r--mysys/my_open.c7
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 */
}