Commit 6e0dfc6f by lhchavez

Make stdalloc__reallocarray call stdalloc__realloc

This change avoids calling realloc(3) in more than one place.
parent bda08397
......@@ -88,11 +88,10 @@ static void *stdalloc__reallocarray(void *ptr, size_t nelem, size_t elsize, cons
{
size_t newsize;
GIT_UNUSED(file);
GIT_UNUSED(line);
if (GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize))
return NULL;
return GIT_MULTIPLY_SIZET_OVERFLOW(&newsize, nelem, elsize) ?
NULL : realloc(ptr, newsize);
return stdalloc__realloc(ptr, newsize, file, line);
}
static void *stdalloc__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