Commit cb0e4f5f authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

user32: Fix a memory allocation strategy.

Otherwise, the function allocates a heap memory when prev_size is enough. What is worse is that it returns the buffer untouched if the prev_size is insufficient. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53703
parent 548a6afc
......@@ -747,7 +747,8 @@ void dispatch_win_proc_params( struct win_proc_params *params )
/* make sure that there is space for 'size' bytes in buffer, growing it if needed */
static inline void *get_buffer_space( void **buffer, size_t size, size_t prev_size )
{
if (prev_size > size && !(*buffer = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL;
if (prev_size < size)
*buffer = HeapAlloc( GetProcessHeap(), 0, size );
return *buffer;
}
......
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