Commit 9361b619 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

msvcrt: Fix a possible memory leak in _wpopen if a memory allocation fails.

parent 587a9aa9
...@@ -1079,7 +1079,12 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wc ...@@ -1079,7 +1079,12 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wc
if (!(comspec = msvcrt_get_comspec())) goto error; if (!(comspec = msvcrt_get_comspec())) goto error;
len = strlenW(comspec) + strlenW(flag) + strlenW(command) + 1; 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); strcpyW(fullcmd, comspec);
strcatW(fullcmd, flag); strcatW(fullcmd, flag);
strcatW(fullcmd, command); strcatW(fullcmd, command);
......
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