winedbg: Fix a memory leak

Andrew Talbot andrew.talbot at talbotville.com
Tue Oct 23 12:06:30 CDT 2007


Avoid a leak if pos == 0 and new != NULL.

-- Andy.
---
Changelog:
    winedbg: Fix a memory leak.

diff --git a/programs/winedbg/source.c b/programs/winedbg/source.c
index c1fb2eb..64abd01 100644
--- a/programs/winedbg/source.c
+++ b/programs/winedbg/source.c
@@ -71,8 +71,9 @@ void source_add_path(const char* path)
     if (search_path)
     {
         unsigned pos = HeapSize(GetProcessHeap(), 0, search_path);
+        if (pos == 0) return;
         new = HeapReAlloc(GetProcessHeap(), 0, search_path, pos + size);
-        if (!new || !pos) return;
+        if (!new) return;
         new[pos - 1] = ';';
         strcpy(&new[pos], path);
     }



More information about the wine-patches mailing list