From: Dave Mitchell Date: Thu, 5 May 2005 20:52:11 +0000 (+0000) Subject: avoid accessing a just-freed SV (keep ponie happy) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=10dc53a8154025af62e262e2eb794f2ba054e8e5;p=p5sagit%2Fp5-mst-13.2.git avoid accessing a just-freed SV (keep ponie happy) p4raw-id: //depot/perl@24402 --- diff --git a/pad.c b/pad.c index 5b1148c..280b46c 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));