From f248b511d4cec43cf11c513349ec774637fe412b Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Tue, 6 Nov 2012 23:59:51 -0800 Subject: [PATCH] Another regexp charclass leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Compiling a negated character class can cause internal temporary sca- lars to leak, as of v5.17.1-252-gea364ff. (I don’t understand how v5.17.1-252-gea364ff caused it, but bisect points to it.) --- regcomp.c | 2 +- t/op/svleak.t | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index 9e48dcd..740bc94 100644 --- a/regcomp.c +++ b/regcomp.c @@ -13178,7 +13178,7 @@ parseit: av_store(av, 0, (HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) ? listsv - : &PL_sv_undef); + : (SvREFCNT_dec(listsv), &PL_sv_undef)); if (swash) { av_store(av, 1, swash); SvREFCNT_dec(cp_list); diff --git a/t/op/svleak.t b/t/op/svleak.t index 129bd0a..dda77ac 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -15,7 +15,7 @@ BEGIN { use Config; -plan tests => 56; +plan tests => 57; # 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 @@ -175,6 +175,7 @@ leak(2, 0, eleak(2,0,'/[:]/'); eleak(2,0,'/[\xdf]/i'); +eleak(2,0,'s![^/]!!'); leak(2,0,sub { !$^V }, '[perl #109762] version object in boolean context'); -- 2.7.4