eval { s/$foo/die/e } leaked a scalar
Dave Mitchell [Sat, 20 May 2006 14:30:50 +0000 (14:30 +0000)]
p4raw-id: //depot/perl@28254

pp_ctl.c
pp_hot.c

index 21b96f7..1cdf592 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -245,7 +245,6 @@ PP(pp_substcont)
            if (DO_UTF8(dstr))
                SvUTF8_on(targ);
            SvPV_set(dstr, NULL);
-           sv_free(dstr);
 
            TAINT_IF(cx->sb_rxtainted & 1);
            PUSHs(sv_2mortal(newSViv(saviters - 1)));
index 7b0c128..891f3de 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2297,6 +2297,7 @@ PP(pp_subst)
 #endif
        rxtainted |= RX_MATCH_TAINTED(rx);
        dstr = newSVpvn(m, s-m);
+       SAVEFREESV(dstr);
        if (DO_UTF8(TARG))
            SvUTF8_on(dstr);
        PL_curpm = pm;
@@ -2353,7 +2354,6 @@ PP(pp_subst)
        SvLEN_set(TARG, SvLEN(dstr));
        doutf8 |= DO_UTF8(dstr);
        SvPV_set(dstr, NULL);
-       sv_free(dstr);
 
        TAINT_IF(rxtainted & 1);
        SPAGAIN;