diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-06-22 14:22:18 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-15 16:41:03 -0400 |
commit | fcc7ba414e1dfab70136a824775421b26ce1b81a (patch) | |
tree | b3debe46fa70ccadda7def5fc0258dae16445b01 /libraries/base/cbits | |
parent | 1854fc23489baa39cb37f8d49ff74b7ee78d7de1 (diff) | |
download | haskell-fcc7ba414e1dfab70136a824775421b26ce1b81a.tar.gz |
winio: Fix potential spaceleak in __createUUIDTempFileErrNo
Diffstat (limited to 'libraries/base/cbits')
-rw-r--r-- | libraries/base/cbits/Win32Utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/cbits/Win32Utils.c b/libraries/base/cbits/Win32Utils.c index e886cceb9f..f3dec0d98d 100644 --- a/libraries/base/cbits/Win32Utils.c +++ b/libraries/base/cbits/Win32Utils.c @@ -170,6 +170,7 @@ BOOL file_exists(LPCTSTR path) bool __createUUIDTempFileErrNo (wchar_t* pathName, wchar_t* prefix, wchar_t* suffix, wchar_t** tempFileName) { + *tempFileName = NULL; int retry = 5; bool success = false; while (retry-- > 0 && !success) @@ -215,6 +216,9 @@ bool __createUUIDTempFileErrNo (wchar_t* pathName, wchar_t* prefix, return success; fail: + if (*tempFileName != NULL) { + free (*tempFileName); + } maperrno(); return false; } |