Commit f41214ed authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

hhctrl: Handle memory allocation failure in GetChmString.

parent 73bbada7
...@@ -32,18 +32,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp); ...@@ -32,18 +32,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset) static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
{ {
LPCSTR str; LPCSTR str;
char **new_strings;
if(!chm->strings_stream) if(!chm->strings_stream)
return NULL; return NULL;
if(chm->strings_size <= (offset >> BLOCK_BITS)) { if(chm->strings_size <= (offset >> BLOCK_BITS)) {
chm->strings_size = (offset >> BLOCK_BITS)+1; chm->strings_size = (offset >> BLOCK_BITS)+1;
if(chm->strings) if(chm->strings) {
chm->strings = heap_realloc_zero(chm->strings, new_strings = heap_realloc_zero(chm->strings,
chm->strings_size*sizeof(char*)); chm->strings_size*sizeof(char*));
else if(!new_strings)
return NULL;
chm->strings = new_strings;
}else {
chm->strings = heap_alloc_zero( chm->strings = heap_alloc_zero(
chm->strings_size*sizeof(char*)); chm->strings_size*sizeof(char*));
if(!chm->strings)
return NULL;
}
} }
......
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