From: Adrian M. Enache Date: Mon, 8 Dec 2003 03:38:39 +0000 (+0000) Subject: yet another leak. bigger fish still swimming around. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=988e6e7e0f6b44b3b1bb6149117affb3c43e8600;p=p5sagit%2Fp5-mst-13.2.git yet another leak. bigger fish still swimming around. #!perl eval q{ $_ = "x"; s/x/"in subst"/e } while 1; __END__ p4raw-id: //depot/perl@21868 --- diff --git a/pp_ctl.c b/pp_ctl.c index 8ce813c..045edd4 100644 --- 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);