[PATCH 1/3] msvcrt: Lock the heap in _callnewh

Martin Storsjo martin at martin.st
Fri Nov 6 04:28:14 CST 2015


Also return the return value of the new handler function.
MSDN hints that _callnewh should return 1 if memory allocation
can be retried.

Signed-off-by: Martin Storsjo <martin at martin.st>
---
 dlls/msvcrt/heap.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index bb265bf..eaf926e 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -234,9 +234,12 @@ int CDECL MSVCRT__set_new_mode(int mode)
  */
 int CDECL _callnewh(MSVCRT_size_t size)
 {
+  int ret = 0;
+  LOCK_HEAP;
   if(MSVCRT_new_handler)
-    (*MSVCRT_new_handler)(size);
-  return 0;
+    ret = (*MSVCRT_new_handler)(size);
+  UNLOCK_HEAP;
+  return ret;
 }
 
 /*********************************************************************
-- 
1.8.1.2




More information about the wine-patches mailing list