Re: [patch] rid "Scalars leaked" from perl_clone
Doug MacEachern [Sat, 4 Aug 2001 11:09:37 +0000 (04:09 -0700)]
Message-ID: <Pine.LNX.4.21.0108041102390.23972-100000@mako.covalent.net>

p4raw-id: //depot/perl@11576

sv.c

diff --git a/sv.c b/sv.c
index 5269aba..2eacc33 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -9090,6 +9090,11 @@ Perl_sv_dup(pTHX_ SV *sstr, clone_params* param)
        CvROOT(dstr)    = OpREFCNT_inc(CvROOT(sstr));
        CvXSUB(dstr)    = CvXSUB(sstr);
        CvXSUBANY(dstr) = CvXSUBANY(sstr);
+       if (CvCONST(sstr)) {
+           CvXSUBANY(dstr).any_ptr = GvUNIQUE(CvGV(sstr)) ?
+                SvREFCNT_inc(CvXSUBANY(sstr).any_ptr) :
+                sv_dup_inc(CvXSUBANY(sstr).any_ptr, param);
+       }
        CvGV(dstr)      = gv_dup(CvGV(sstr), param);
        if (param->flags & CLONEf_COPY_STACKS) {
          CvDEPTH(dstr) = CvDEPTH(sstr);