Lionel Debroux : winhelp: Fix memory leaks (found by Smatch).
Alexandre Julliard
julliard at winehq.org
Thu Dec 13 08:23:14 CST 2007
Module: wine
Branch: master
Commit: 14bed07c99843f2d196fd6b3481492f3a28c7adc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=14bed07c99843f2d196fd6b3481492f3a28c7adc
Author: Lionel Debroux <lionel_debroux at yahoo.fr>
Date: Sun Dec 9 09:47:42 2007 +0100
winhelp: Fix memory leaks (found by Smatch).
---
programs/winhelp/hlpfile.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index ff041ec..3a9717a 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1613,7 +1613,12 @@ static BOOL HLPFILE_UncompressLZ77_Phrases(HLPFILE* hlpfile)
phrases.offsets = HeapAlloc(GetProcessHeap(), 0, sizeof(unsigned) * (num + 1));
phrases.buffer = HeapAlloc(GetProcessHeap(), 0, dec_size);
- if (!phrases.offsets || !phrases.buffer) return FALSE;
+ if (!phrases.offsets || !phrases.buffer)
+ {
+ HeapFree(GetProcessHeap(), 0, phrases.offsets);
+ HeapFree(GetProcessHeap(), 0, phrases.buffer);
+ return FALSE;
+ }
for (i = 0; i <= num; i++)
phrases.offsets[i] = GET_USHORT(buf, head_size + 2 * i) - 2 * num - 2;
@@ -1672,7 +1677,12 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile)
phrases.offsets = HeapAlloc(GetProcessHeap(), 0, sizeof(unsigned) * (num + 1));
phrases.buffer = HeapAlloc(GetProcessHeap(), 0, dec_size);
- if (!phrases.offsets || !phrases.buffer) return FALSE;
+ if (!phrases.offsets || !phrases.buffer)
+ {
+ HeapFree(GetProcessHeap(), 0, phrases.offsets);
+ HeapFree(GetProcessHeap(), 0, phrases.buffer);
+ return FALSE;
+ }
#define getbit() (ptr += (mask < 0), mask = mask*2 + (mask<=0), (*ptr & mask) != 0)
More information about the wine-cvs
mailing list