summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-02-21 12:35:48 +0100
committerPatrick Steinhardt <ps@pks.im>2019-02-21 13:23:54 +0100
commit765ff6e029a422d910ec65c38fd16ed90caff7b5 (patch)
tree748bf31397af36223fee7f5b41c6b6ef77e8810c
parent48727e5d3bc0922a2073b717a6ee449e9bb0ddd7 (diff)
downloadlibgit2-765ff6e029a422d910ec65c38fd16ed90caff7b5.tar.gz
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.
-rw-r--r--src/allocators/win32_crtdbg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/allocators/win32_crtdbg.c b/src/allocators/win32_crtdbg.c
index d1539d54b..1187e2fcd 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)