Commit ac524986 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

winhelp: Fix a memory leak.

parent 4d2e148f
......@@ -860,7 +860,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
HLPFILE_PARAGRAPH *paragraph, **paragraphptr;
UINT textsize;
BYTE *format, *format_end;
char *text, *text_end;
char *text, *text_base, *text_end;
long size;
unsigned short bits;
unsigned nc, ncol = 1;
......@@ -874,7 +874,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
if (buf + 0x19 > end) {WINE_WARN("header too small\n"); return FALSE;};
size = GET_UINT(buf, 0x4);
text = HeapAlloc(GetProcessHeap(), 0, size);
text = text_base = HeapAlloc(GetProcessHeap(), 0, size);
if (!text) return FALSE;
if (hlpfile->hasPhrases)
{
......@@ -1164,8 +1164,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
}
}
}
if (text_end != (char*)buf + GET_UINT(buf, 0x10) + size)
HeapFree(GetProcessHeap(), 0, text_end - size);
HeapFree(GetProcessHeap(), 0, text_base);
return TRUE;
}
......
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