psapi/tests: Free buffer on error (valgrind)

Bruno Jesus 00cpxxx at gmail.com
Sat Jul 12 13:24:36 CDT 2014


Fixes bug https://bugs.winehq.org/show_bug.cgi?id=36314
-------------- next part --------------
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index ee7e8bd..62d4f5c 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -228,7 +228,11 @@ static BOOL nt_get_mapped_file_name(HANDLE process, LPVOID addr, LPWSTR name, DW
 todo_wine
     ok(!status, "NtQueryVirtualMemory error %x\n", status);
     /* FIXME: remove once Wine is fixed */
-    if (status) return FALSE;
+    if (status)
+    {
+        HeapFree(GetProcessHeap(), 0, buf);
+        return FALSE;
+    }
 
     section_name = (MEMORY_SECTION_NAME *)buf;
     ok(ret_len == section_name->SectionFileName.MaximumLength + sizeof(*section_name), "got %lu, %u\n",


More information about the wine-patches mailing list