Commit 765ff6e0 by Patrick Steinhardt

allocators: make crtdbg allocator reuse its own realloc

In commit 6e0dfc6f (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.
parent 48727e5d
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment