Andrew Talbot : winhelp: Fix a memory leak.
Alexandre Julliard
julliard at winehq.org
Fri Oct 26 08:34:47 CDT 2007
Module: wine
Branch: master
Commit: ac524986df2a207b563fc6ef296c89744b7163c8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac524986df2a207b563fc6ef296c89744b7163c8
Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date: Thu Oct 25 20:07:47 2007 +0100
winhelp: Fix a memory leak.
---
programs/winhelp/hlpfile.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 8882a1a..3c34a06 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -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;
}
More information about the wine-cvs
mailing list