Martin Storsjo : msvcrt: Pass on the return value in _callnewh.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 9 08:34:17 CST 2015


Module: wine
Branch: master
Commit: e66758dd531646aa6707c71f7e6f23ffec4cb1a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e66758dd531646aa6707c71f7e6f23ffec4cb1a0

Author: Martin Storsjo <martin at martin.st>
Date:   Fri Nov  6 14:51:55 2015 +0200

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 at martin.st>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list