aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/common_allocation.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index e398e19ae..cd7175eac 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -370,7 +370,8 @@ GNUNET_xgrow_ (void **old,
370 memset (tmp, 0, size); /* client code should not rely on this, though... */ 370 memset (tmp, 0, size); /* client code should not rely on this, though... */
371 if (*oldCount > newCount) 371 if (*oldCount > newCount)
372 *oldCount = newCount; /* shrink is also allowed! */ 372 *oldCount = newCount; /* shrink is also allowed! */
373 memcpy (tmp, *old, elementSize * (*oldCount)); 373 if (NULL != *old)
374 memcpy (tmp, *old, elementSize * (*oldCount));
374 } 375 }
375 376
376 if (*old != NULL) 377 if (*old != NULL)