This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
yet another leak. bigger fish still swimming around.
authorAdrian M. Enache <enache@rdslink.ro>
Mon, 8 Dec 2003 03:38:39 +0000 (03:38 +0000)
committerEnache Adrian <enache@rdslink.ro>
Mon, 8 Dec 2003 03:38:39 +0000 (03:38 +0000)
#!perl
eval q{ $_ = "x"; s/x/"in subst"/e } while 1;
__END__

p4raw-id: //depot/perl@21868

pp_ctl.c

index 8ce813c..045edd4 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -159,14 +159,11 @@ PP(pp_substcont)
     char *orig = cx->sb_orig;
     register REGEXP *rx = cx->sb_rx;
     SV *nsv = Nullsv;
-
-    { 
-      REGEXP *old = PM_GETRE(pm);
-      if(old != rx) {
+    REGEXP *old = PM_GETRE(pm);
+    if(old != rx) {
        if(old) 
-         ReREFCNT_dec(old);
+           ReREFCNT_dec(old);
        PM_SETRE(pm,rx);
-      }
     }
 
     rxres_restore(&cx->sb_rxres, rx);
@@ -259,7 +256,8 @@ PP(pp_substcont)
            sv_pos_b2u(sv, &i);
        mg->mg_len = i;
     }
-    ReREFCNT_inc(rx);
+    if (old != rx)
+       ReREFCNT_inc(rx);
     cx->sb_rxtainted |= RX_MATCH_TAINTED(rx);
     rxres_save(&cx->sb_rxres, rx);
     RETURNOP(pm->op_pmreplstart);