[PATCH] shell32: avoid memory leaking buf (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Oct 13 10:19:40 CDT 2012


Hi,

trivial memory leak fixed. Also check HeapAlloc OOM return in the same
place (but just this).

CIao, Marcus
---
 dlls/shell32/shlexec.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 5799ab0..1c6fa29 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1724,8 +1724,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
 
         size = MAX_PATH;
         buf = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
-        if (FAILED(PathCreateFromUrlW(sei_tmp.lpFile, buf, &size, 0)))
+        if (!buf || FAILED(PathCreateFromUrlW(sei_tmp.lpFile, buf, &size, 0))) {
+            HeapFree(GetProcessHeap(), 0, buf);
             return SE_ERR_OOM;
+        }
 
         HeapFree(GetProcessHeap(), 0, wszApplicationName);
         dwApplicationNameLen = lstrlenW(buf) + 1;
-- 
1.7.3.4




More information about the wine-patches mailing list