https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f7187f092a1f9facfead91795b638beec1d3af2d

commit f7187f092a1f9facfead91795b638beec1d3af2d
Author:     winesync <ros-...@reactos.org>
AuthorDate: Fri Sep 11 14:31:29 2020 +0200
Commit:     Jérôme Gardou <jerome.gar...@reactos.org>
CommitDate: Wed Sep 16 10:35:35 2020 +0200

    [WINESYNC] dbghelp: Fix memory leak in SymInitializeW() (Coverity).
    
    Signed-off-by: Józef Kucia <jku...@codeweavers.com>
    Signed-off-by: Alexandre Julliard <julli...@winehq.org>
    
    wine commit id b3717a92d11c84819ce934da39bc8f9c85582c9a by Józef Kucia 
<jku...@codeweavers.com>
---
 dll/win32/dbghelp/dbghelp.c    | 13 +++++++------
 sdk/tools/winesync/dbghelp.cfg |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dll/win32/dbghelp/dbghelp.c b/dll/win32/dbghelp/dbghelp.c
index 732309567a9..1c540cb74f4 100644
--- a/dll/win32/dbghelp/dbghelp.c
+++ b/dll/win32/dbghelp/dbghelp.c
@@ -312,7 +312,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.
@@ -321,15 +322,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)
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 088fac7999f..6350d526bd5 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -3,4 +3,4 @@ directories:
 files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
 tags:
-  wine: ca9b1d0077874c94715cd2ceeff114853151ed2d
+  wine: b3717a92d11c84819ce934da39bc8f9c85582c9a

Reply via email to