summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-10-19 17:14:58 +0100
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:18:31 +0000
commit33e0807aaf1fafae141d37e3b88af556c8b25c44 (patch)
treeb87ba03b0513c4a5469cefac7579463339966aab /cop.h
parenta7db2e35a577614d7a6eaf05114b2d6224f0ab33 (diff)
downloadperl-33e0807aaf1fafae141d37e3b88af556c8b25c44.tar.gz
make POPGIVEN re-entrant safe
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/cop.h b/cop.h
index f6280a9ec4..d95c79904c 100644
--- a/cop.h
+++ b/cop.h
@@ -873,8 +873,12 @@ struct block_givwhen {
NOOP;
#define POPGIVEN(cx) \
- SvREFCNT_dec(GvSV(PL_defgv)); \
- GvSV(PL_defgv) = cx->blk_givwhen.defsv_save;
+ STMT_START { \
+ SV *sv = GvSV(PL_defgv); \
+ GvSV(PL_defgv) = cx->blk_givwhen.defsv_save; \
+ cx->blk_givwhen.defsv_save = NULL; \
+ SvREFCNT_dec(sv); \
+ } STMT_END
/* basic block, i.e. pp_enter/leave */