about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/mwrap/mwrap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c
index 8d8b19f..c0cf8ff 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -545,7 +545,7 @@ void *realloc(void *ptr, size_t size)
         }
         rcu_read_unlock();
 
-        if (ptr) {
+        if (ptr && p) {
                 struct alloc_hdr *old = ptr2hdr(ptr);
                 memcpy(p, ptr, old->size < size ? old->size : size);
                 free(ptr);