diff options
author | Eric Wong <e@80x24.org> | 2018-07-14 05:14:11 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-07-16 19:34:32 +0000 |
commit | 383c26ea407cf130ad63edfca5bee44e6b282252 (patch) | |
tree | 462522f9cc692dc6a08ea9d8896e5508e2da1a7b | |
parent | 233f8c2c3ac5997df1467c283fef51405e505bf1 (diff) | |
download | mwrap-383c26ea407cf130ad63edfca5bee44e6b282252.tar.gz |
We shouldn't try to read NULL pointers :x
-rw-r--r-- | ext/mwrap/mwrap.c | 2 |
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); |