Remove small memory leak in newATTRSUB that manifested as a
Dave Mitchell [Sun, 25 Jan 2004 02:04:23 +0000 (02:04 +0000)]
leaking scalar after the interpeter was cloned

p4raw-id: //depot/perl@22209

op.c

diff --git a/op.c b/op.c
index b902fed..5fd21bf 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4165,6 +4165,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
        /* transfer PL_compcv to cv */
        cv_undef(cv);
        CvFLAGS(cv) = CvFLAGS(PL_compcv);
+       if (!CvWEAKOUTSIDE(cv))
+           SvREFCNT_dec(CvOUTSIDE(cv));
        CvOUTSIDE(cv) = CvOUTSIDE(PL_compcv);
        CvOUTSIDE_SEQ(cv) = CvOUTSIDE_SEQ(PL_compcv);
        CvOUTSIDE(PL_compcv) = 0;