[PATCH v2 1/3] msvcrt: Pass on the return value in _callnewh

Martin Storsjo martin at martin.st
Fri Nov 6 06:51:55 CST 2015


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 at martin.st>
---
 dlls/msvcrt/heap.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index bb265bf..02e69fe 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -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;
 }
 
 /*********************************************************************
-- 
1.8.1.2




More information about the wine-patches mailing list