about summary refs log tree commit homepage
path: root/ext/mwrap/mwrap.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-09 00:19:11 +0000
committerEric Wong <e@yhbt.net>2022-08-09 16:37:48 +0000
commit4a90540056afce4f73da97300e6709993355fe4f (patch)
treecf8f1814ee0bc456b913c89e79b35903458358d3 /ext/mwrap/mwrap.c
parent5120b83117179f81c7c73c41c122da0f6f5cbdb7 (diff)
downloadmwrap-4a90540056afce4f73da97300e6709993355fe4f.tar.gz
We must not forget to release RCU read locks even if the
process will probably die, soon, due to ENOMEM.

I noticed this while working on the Perl5/XS port.

Link: https://80x24.org/mwrap-perl/20191102020331.28050-4-e@80x24.org/
Diffstat (limited to 'ext/mwrap/mwrap.c')
-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 2ee04a5..4575e34 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -632,9 +632,9 @@ internal_memalign(void **pp, size_t alignment, size_t size, uintptr_t caller)
                                 p = ptr_align(p, alignment);
                         h = ptr2hdr(p);
                         alloc_insert_rcu(l, h, size, real);
-                        update_stats_rcu_unlock(l);
                         *pp = p;
                 }
+                update_stats_rcu_unlock(l);
         }
 
         return real ? 0 : ENOMEM;