msvcrt: Pass on the return value in _callnewh.

Also try to avoid race conditions by storing the new handler in a local
variable before checking whether it's non-null.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Martin Storsjo 2015-11-06 14:51:55 +02:00 committed by Alexandre Julliard
parent eb5f7531ac
commit e66758dd53
1 changed files with 5 additions and 3 deletions

View File

@ -234,9 +234,11 @@ int CDECL MSVCRT__set_new_mode(int mode)
*/
int CDECL _callnewh(MSVCRT_size_t size)
{
if(MSVCRT_new_handler)
(*MSVCRT_new_handler)(size);
return 0;
int ret = 0;
MSVCRT_new_handler_func handler = MSVCRT_new_handler;
if(handler)
ret = (*handler)(size) ? 1 : 0;
return ret;
}
/*********************************************************************