Commit 14bed07c authored by Lionel Debroux's avatar Lionel Debroux Committed by Alexandre Julliard

winhelp: Fix memory leaks (found by Smatch).

parent fe444f02
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment