dbghelp: Fix memory leak in SymInitializeW() (Coverity).

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-09-19 12:26:56 +02:00 committed by Alexandre Julliard
parent 4100bac563
commit b3717a92d1
1 changed files with 7 additions and 6 deletions

View File

@ -298,7 +298,8 @@ BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeP
TRACE("(%p %s %u)\n", hProcess, debugstr_w(UserSearchPath), fInvadeProcess);
if (process_find_by_handle(hProcess)){
if (process_find_by_handle(hProcess))
{
WARN("the symbols for this process have already been initialized!\n");
/* MSDN says to only call this function once unless SymCleanup() has been called since the last call.
@ -307,15 +308,15 @@ BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeP
return TRUE;
}
pcs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pcs));
if (!pcs) return FALSE;
pcs->handle = hProcess;
IsWow64Process(GetCurrentProcess(), &wow64);
if (!IsWow64Process(hProcess, &child_wow64))
return FALSE;
pcs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pcs));
if (!pcs) return FALSE;
pcs->handle = hProcess;
pcs->is_64bit = (sizeof(void *) == 8 || wow64) && !child_wow64;
if (UserSearchPath)