Commit 12c6e1facc1b7644ed2c51df35625b36bad92340

Patrick Steinhardt 2019-02-20T10:54:00

Merge pull request #4986 from lhchavez/realloc Make stdalloc__reallocarray call stdalloc__realloc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/stdalloc.c b/src/stdalloc.c
index c6d4ec8..c4938e3 100644
--- a/src/stdalloc.c
+++ b/src/stdalloc.c
@@ -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)