Fixes: https://bugs.winehq.org/show_bug.cgi?id=44001
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msvcrtd/debug.c | 2 +- dlls/msvcrtd/tests/debug.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrtd/debug.c b/dlls/msvcrtd/debug.c index b8496526ae..6bfa730ece 100644 --- a/dlls/msvcrtd/debug.c +++ b/dlls/msvcrtd/debug.c @@ -52,6 +52,7 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse, switch(_BLOCK_TYPE(nBlockUse)) { case _NORMAL_BLOCK: + case _CRT_BLOCK: break; case _CLIENT_BLOCK: FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n"); @@ -59,7 +60,6 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse, case _FREE_BLOCK: FIXME("Native code throws an exception here\n"); return NULL; - case _CRT_BLOCK: case _IGNORE_BLOCK: ERR("Not allowed nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse)); return NULL; diff --git a/dlls/msvcrtd/tests/debug.c b/dlls/msvcrtd/tests/debug.c index 9055db1382..d234f02f6d 100644 --- a/dlls/msvcrtd/tests/debug.c +++ b/dlls/msvcrtd/tests/debug.c @@ -65,6 +65,10 @@ static void test_new(void) mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__); ok(mem != NULL, "memory not allocated\n"); HeapFree(GetProcessHeap(), 0, mem); + + mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__); + ok(mem != NULL, "memory not allocated\n"); + HeapFree(GetProcessHeap(), 0, mem); }
/**********************************************************************/
Hi Alistair,
On 04/04/18 02:26, Alistair Leslie-Hughes wrote:
@@ -52,6 +52,7 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse, switch(_BLOCK_TYPE(nBlockUse)) { case _NORMAL_BLOCK:
- case _CRT_BLOCK: break; case _CLIENT_BLOCK: FIXME("Unimplemented case for nBlockUse = _CLIENT_BLOCK\n");
@@ -59,7 +60,6 @@ void * CDECL MSVCRTD_operator_new_dbg(MSVCRT_size_t nSize, int nBlockUse, case _FREE_BLOCK: FIXME("Native code throws an exception here\n"); return NULL;
- case _CRT_BLOCK: case _IGNORE_BLOCK: ERR("Not allowed nBlockUse value: %d\n", _BLOCK_TYPE(nBlockUse)); return NULL;
Is there a reason for not calling msvcrt.operator_new_dbg instead of implementing the function here? We don't have proper operator_new_dbg implementation anyway. According to my tests it's also possible to allocate _IGNORE_BLOCK. _FREE_BLOCK is terminating the app in msvcrtd case and works in msvcrt (I don't expect any application to depend on that behavior).
- mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__);
- ok(mem != NULL, "memory not allocated\n");
- HeapFree(GetProcessHeap(), 0, mem);
You can't free the memory that way. Please call operator delete.
Thanks, Piotr