X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=op.c;h=c46bbfce0ea5d385fb9e2f0f5374428ae6a47461;hb=7e107e90b7bd52c7fb110ac98da6bb7ab38e8959;hp=c3aee1e68b778990b1fa214ac8e39793dadb2ce9;hpb=39aa8287bdfc9ec0aeb8d8ace09b665ef71c53a8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/op.c b/op.c index c3aee1e..c46bbfc 100644 --- a/op.c +++ b/op.c @@ -3756,7 +3756,6 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) void Perl_cv_undef(pTHX_ CV *cv) { - CV *outsidecv; CV *freecv = Nullcv; #ifdef USE_ITHREADS @@ -3780,20 +3779,21 @@ Perl_cv_undef(pTHX_ CV *cv) } SvPOK_off((SV*)cv); /* forget prototype */ CvGV(cv) = Nullgv; - outsidecv = CvOUTSIDE(cv); + + pad_undef(cv); + /* Since closure prototypes have the same lifetime as the containing * CV, they don't hold a refcount on the outside CV. This avoids * the refcount loop between the outer CV (which keeps a refcount to * the closure prototype in the pad entry for pp_anoncode()) and the * closure prototype, and the ensuing memory leak. --GSAR */ if (!CvANON(cv) || CvCLONED(cv)) - freecv = outsidecv; + freecv = CvOUTSIDE(cv); CvOUTSIDE(cv) = Nullcv; if (CvCONST(cv)) { SvREFCNT_dec((SV*)CvXSUBANY(cv).any_ptr); CvCONST_off(cv); } - pad_undef(cv, outsidecv); if (freecv) SvREFCNT_dec(freecv); if (CvXSUB(cv)) { @@ -4086,9 +4086,11 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) SAVEFREESV(PL_compcv); goto done; } + /* transfer PL_compcv to cv */ cv_undef(cv); CvFLAGS(cv) = CvFLAGS(PL_compcv); CvOUTSIDE(cv) = CvOUTSIDE(PL_compcv); + CvOUTSIDE_SEQ(cv) = CvOUTSIDE_SEQ(PL_compcv); CvOUTSIDE(PL_compcv) = 0; CvPADLIST(cv) = CvPADLIST(PL_compcv); CvPADLIST(PL_compcv) = 0;