diff options
author | Eric Wong <e@80x24.org> | 2018-07-14 05:34:32 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-07-16 19:34:32 +0000 |
commit | d95aeb450fec9c4e4836179f7cdf6fcafba3e119 (patch) | |
tree | 4ffcb67390532b147e046d53c4e739fb1773df32 /ext | |
parent | 383c26ea407cf130ad63edfca5bee44e6b282252 (diff) | |
download | mwrap-d95aeb450fec9c4e4836179f7cdf6fcafba3e119.tar.gz |
Oops :x
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mwrap/mwrap.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c index c0cf8ff..fa52631 100644 --- a/ext/mwrap/mwrap.c +++ b/ext/mwrap/mwrap.c @@ -408,12 +408,14 @@ static void *internal_memalign(size_t alignment, size_t size, uintptr_t caller) /* assert(asize == (alignment + size + sizeof(struct alloc_hdr))); */ rcu_read_lock(); l = update_stats_rcu(size, caller); - real = real_malloc(asize); - p = hdr2ptr(real); - if (!ptr_is_aligned(p, alignment)) - p = ptr_align(p, alignment); - h = ptr2hdr(p); - alloc_insert_rcu(l, h, size, real); + p = real = real_malloc(asize); + if (real) { + p = hdr2ptr(real); + if (!ptr_is_aligned(p, alignment)) + p = ptr_align(p, alignment); + h = ptr2hdr(p); + alloc_insert_rcu(l, h, size, real); + } rcu_read_unlock(); return p; |