In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d97935e01b36de894b55057e3945044c9d47dfc9?hp=c50bda7c602d34fbc8752fc972be6f3050164834>
- Log ----------------------------------------------------------------- commit d97935e01b36de894b55057e3945044c9d47dfc9 Author: David Mitchell <[email protected]> Date: Wed Aug 1 13:31:03 2012 +0100 stop /$unchanging/ leaking 9f141731d83a1ac6294a5580a5b11ff41490309a, part of the re_eval jumbo fix, introduced a leak. It incremented the ref count of a run-time regex each time it was re-used, i.e. where the pattern hadn't changed. ----------------------------------------------------------------------- Summary of changes: regcomp.c | 1 - t/op/svleak.t | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index 2bda5da..9e16aa0 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5693,7 +5693,6 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, runtime_code = S_has_runtime_code(aTHX_ pRExC_state, expr, pm_flags, exp, plen); if (!runtime_code) { - ReREFCNT_inc(old_re); if (used_setjump) { JMPENV_POP; } diff --git a/t/op/svleak.t b/t/op/svleak.t index df10953..4a92bc7 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -13,7 +13,7 @@ BEGIN { or skip_all("XS::APItest not available"); } -plan tests => 21; +plan tests => 22; # run some code N times. If the number of SVs at the end of loop N is # greater than (N-1)*delta at the end of loop 1, we've got a leak @@ -160,3 +160,9 @@ leak(2, 0, } leak(2,0,sub { !$^V }, '[perl #109762] version object in boolean context'); + + +# [perl #114356] run-time rexexp with unchanging pattern got +# inflated refcounts + +leak(2, 0, sub { eval q{ my $x = "x"; "abc" =~ /$x/ for 1..5 } }, '#114356'); -- Perl5 Master Repository
