summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorChris Heath <chris@heathens.co.nz>2005-11-06 12:08:05 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-11-07 09:58:26 +0000
commit21401c75f1c38e127fa870b81fca15879c466865 (patch)
tree05dc6a5bf0c21b4a1d11b33cc06625f47aae2b2f /cop.h
parent03e3cfa350ab0751663457000c3c7743ae7d5de1 (diff)
downloadperl-21401c75f1c38e127fa870b81fca15879c466865.tar.gz
[perl #24254] Attempt to free unreferenced scalar
From: "Chris Heath via RT" <perlbug-followup@perl.org> Message-ID: <rt-3.0.11-24254-123984.4.44134155985068@perl.org> p4raw-id: //depot/perl@26027
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/cop.h b/cop.h
index f2e4463a19..47c2375b7b 100644
--- a/cop.h
+++ b/cop.h
@@ -407,9 +407,14 @@ struct block_loop {
#define POPLOOP(cx) \
SvREFCNT_dec(cx->blk_loop.iterlval); \
if (CxITERVAR(cx)) { \
- SV **s_v_p = CxITERVAR(cx); \
- sv_2mortal(*s_v_p); \
- *s_v_p = cx->blk_loop.itersave; \
+ if (SvPADMY(cx->blk_loop.itersave)) { \
+ SV **s_v_p = CxITERVAR(cx); \
+ sv_2mortal(*s_v_p); \
+ *s_v_p = cx->blk_loop.itersave; \
+ } \
+ else { \
+ SvREFCNT_dec(cx->blk_loop.itersave); \
+ } \
} \
if (cx->blk_loop.iterary && cx->blk_loop.iterary != PL_curstack)\
SvREFCNT_dec(cx->blk_loop.iterary);