Andrew Nguyen : msvcrt: Fix a possible memory leak in _wpopen if a memory allocation fails.
Alexandre Julliard
julliard at winehq.org
Mon Jan 17 10:59:48 CST 2011
Module: wine
Branch: master
Commit: 9361b61949b19ab9ce636ba76c5a5f3f88920736
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9361b61949b19ab9ce636ba76c5a5f3f88920736
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Sat Jan 15 02:28:08 2011 -0600
msvcrt: Fix a possible memory leak in _wpopen if a memory allocation fails.
---
dlls/msvcrt/process.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index 3e2e15e..349efeb 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -1079,7 +1079,12 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wc
if (!(comspec = msvcrt_get_comspec())) goto error;
len = strlenW(comspec) + strlenW(flag) + strlenW(command) + 1;
- if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t)))) goto error;
+ if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
+ {
+ HeapFree(GetProcessHeap(), 0, comspec);
+ goto error;
+ }
+
strcpyW(fullcmd, comspec);
strcatW(fullcmd, flag);
strcatW(fullcmd, command);
More information about the wine-cvs
mailing list