Commit f4a535d6 authored by Andrey Panov's avatar Andrey Panov Committed by Alexandre Julliard

In get_buffer_space() function, HeapReAlloc() will not allocate memory

if passed *buffer value is NULL.
parent b41466b3
......@@ -254,8 +254,14 @@ inline static BOOL check_string( LPCWSTR str, size_t size )
inline static void *get_buffer_space( void **buffer, size_t size )
{
void *ret;
if (!(ret = HeapReAlloc( GetProcessHeap(), 0, *buffer, size )))
HeapFree( GetProcessHeap(), 0, *buffer );
if (*buffer)
{
if (!(ret = HeapReAlloc( GetProcessHeap(), 0, *buffer, size )))
HeapFree( GetProcessHeap(), 0, *buffer );
}
else ret = HeapAlloc( GetProcessHeap(), 0, size );
*buffer = ret;
return ret;
}
......
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