summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2005-05-05 20:52:11 +0000
committerDave Mitchell <davem@fdisolutions.com>2005-05-05 20:52:11 +0000
commit10dc53a8154025af62e262e2eb794f2ba054e8e5 (patch)
tree8ed1d25b056ddf7b26cea85305aa8973788d6764 /pad.c
parent43fd88df83839fa8c94108794f0e58abbe740e5e (diff)
downloadperl-10dc53a8154025af62e262e2eb794f2ba054e8e5.tar.gz
avoid accessing a just-freed SV (keep ponie happy)
p4raw-id: //depot/perl@24402
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pad.c b/pad.c
index 5b1148c1e1..280b46cb1d 100644
--- a/pad.c
+++ b/pad.c
@@ -260,14 +260,17 @@ Perl_pad_undef(pTHX_ CV* cv)
&& *SvPVX(namesv) == '&')
{
CV * const innercv = (CV*)curpad[ix];
+ U32 inner_rc = SvREFCNT(innercv);
+ assert(inner_rc);
namepad[ix] = Nullsv;
SvREFCNT_dec(namesv);
if (SvREFCNT(comppad) < 2) { /* allow for /(?{ sub{} })/ */
curpad[ix] = Nullsv;
SvREFCNT_dec(innercv);
+ inner_rc--;
}
- if (SvREFCNT(innercv) /* in use, not just a prototype */
+ if (inner_rc /* in use, not just a prototype */
&& CvOUTSIDE(innercv) == cv)
{
assert(CvWEAKOUTSIDE(innercv));