summary refs log tree commit diff
path: root/test-skeleton.c
diff options
context:
space:
mode:
Diffstat (limited to 'test-skeleton.c')
-rw-r--r--test-skeleton.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test-skeleton.c b/test-skeleton.c
index 0be4af1daf..d9bf989fa8 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -109,10 +109,10 @@ __attribute__ ((unused))
 static void *
 xrealloc (void *p, size_t n)
 {
-  p = realloc (p, n);
-  if (p == NULL)
+  void *result = realloc (p, n);
+  if (result == NULL && (n > 0 || p == NULL))
     oom_error ("realloc", n);
-  return p;
+  return result;
 }
 
 /* Write a message to standard output.  Can be used in signal