summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-10-19 17:21:58 +0100
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:18:31 +0000
commit77189b8c243837b664cb444e867999e67e87ca44 (patch)
tree5aba360c9e0b0187c08706766d1cc72bfef434f1 /cop.h
parent33e0807aaf1fafae141d37e3b88af556c8b25c44 (diff)
downloadperl-77189b8c243837b664cb444e867999e67e87ca44.tar.gz
make POPSUBST re-entrant safe
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/cop.h b/cop.h
index d95c79904c..4eefc4ce9e 100644
--- a/cop.h
+++ b/cop.h
@@ -1026,9 +1026,14 @@ struct subst {
SvREFCNT_inc_void_NN(targ)
# define POPSUBST(cx) \
+ STMT_START { \
+ REGEXP *re; \
rxres_free(&cx->sb_rxres); \
- ReREFCNT_dec(cx->sb_rx); \
- SvREFCNT_dec_NN(cx->sb_targ)
+ re = cx->sb_rx; \
+ cx->sb_rx = NULL; \
+ ReREFCNT_dec(re); \
+ SvREFCNT_dec_NN(cx->sb_targ); \
+ } STMT_END
#endif
#define CxONCE(cx) ((cx)->cx_type & CXp_ONCE)