Piotr Caban : msvcrt: Respect allocation mode in malloc.
Alexandre Julliard
julliard at winehq.org
Wed Jan 29 16:24:07 CST 2020
Module: wine
Branch: master
Commit: 70ac780e6ed26380fd2fcdfbb96352ca8548bc79
URL: https://source.winehq.org/git/wine.git/?a=commit;h=70ac780e6ed26380fd2fcdfbb96352ca8548bc79
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Jan 29 14:27:25 2020 +0100
msvcrt: Respect allocation mode in malloc.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/heap.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index 0d6aee07f3..512adc1e74 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -441,10 +441,18 @@ void CDECL _free_base(void* ptr)
*/
void* CDECL MSVCRT_malloc(MSVCRT_size_t size)
{
- void *ret = msvcrt_heap_alloc(0, size);
- if (!ret)
- *MSVCRT__errno() = MSVCRT_ENOMEM;
- return ret;
+ void *ret;
+
+ do
+ {
+ ret = msvcrt_heap_alloc(0, size);
+ if (ret || !MSVCRT_new_mode)
+ break;
+ } while(_callnewh(size));
+
+ if (!ret)
+ *MSVCRT__errno() = MSVCRT_ENOMEM;
+ return ret;
}
#if _MSVCR_VER>=140
More information about the wine-cvs
mailing list