winhelp: Fix memory leaks (found by Smatch).

This commit is contained in:
Lionel Debroux 2007-12-09 09:47:42 +01:00 committed by Alexandre Julliard
parent fe444f0217
commit 14bed07c99
1 changed files with 12 additions and 2 deletions

View File

@ -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)