allocators: make crtdbg allocator reuse its own realloc In commit 6e0dfc6ff (Make stdalloc__reallocarray call stdalloc__realloc, 2019-02-16), we have changed the stdalloc allocator to reuse `stdalloc__realloc` to implement `stdalloc__reallocarray`. This commit is making the same change for the Windows-specific crtdbg allocator to avoid code duplication.
diff --git a/src/allocators/win32_crtdbg.c b/src/allocators/win32_crtdbg.c
index d1539d5..1187e2f 100644
--- a/src/allocators/win32_crtdbg.c
+++ b/src/allocators/win32_crtdbg.c
@@ -76,8 +76,10 @@ static void *crtdbg__reallocarray(void *ptr, size_t nelem, size_t elsize, const
{
size_t newsize;
- return GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize) ?
- NULL : _realloc_dbg(ptr, newsize, _NORMAL_BLOCK, git_win32__crtdbg_stacktrace(1,file), line);
+ if (GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize))
+ return NULL;
+
+ return crtdbg__realloc(ptr, newsize, file, line);
}
static void *crtdbg__mallocarray(size_t nelem, size_t elsize, const char *file, int line)