In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/512e01ab009bc6309309e05891effe8ae3c0e9da?hp=4692fc6a8864d5b51d14d412f2c36e08fbad8626>

- Log -----------------------------------------------------------------
commit 512e01ab009bc6309309e05891effe8ae3c0e9da
Author: Karl Williamson <[email protected]>
Date:   Mon Nov 17 21:49:08 2014 -0700

    PATCH: [perl #123198] Memory leak in regex in 5.20.1
    
    The SV was declared temporary but the pointer to it was getting changed
    to another SV under some circumstances and the reference to that wasn't
    getting decremented.  The temporary stemmed from earlier code and was no
    longer needed.  Now, an explicit reference decrement is always done.
-----------------------------------------------------------------------

Summary of changes:
 regcomp.c     | 5 +++--
 t/op/svleak.t | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index 7ea5d89..12c3678 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5144,7 +5144,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n",
            min++;
            if (flags & SCF_DO_STCLASS) {
                 bool invert = 0;
-                SV* my_invlist = sv_2mortal(_new_invlist(0));
+                SV* my_invlist = NULL;
                 U8 namedclass;
 
                 /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */
@@ -5243,7 +5243,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n",
                     /* FALLTHROUGH */
                case POSIXA:
                     if (FLAGS(scan) == _CC_ASCII) {
-                        my_invlist = PL_XPosix_ptrs[_CC_ASCII];
+                        my_invlist = invlist_clone(PL_XPosix_ptrs[_CC_ASCII]);
                     }
                     else {
                         _invlist_intersection(PL_XPosix_ptrs[FLAGS(scan)],
@@ -5280,6 +5280,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n",
                         assert(flags & SCF_DO_STCLASS_OR);
                         ssc_union(data->start_class, my_invlist, invert);
                     }
+                    SvREFCNT_dec(my_invlist);
                }
                if (flags & SCF_DO_STCLASS_OR)
                    ssc_and(pRExC_state, data->start_class, (regnode_charclass 
*) and_withp);
diff --git a/t/op/svleak.t b/t/op/svleak.t
index 358035d..8d42265 100644
--- a/t/op/svleak.t
+++ b/t/op/svleak.t
@@ -256,9 +256,7 @@ eleak(2,0,'/[pp]/');
 eleak(2,0,'/[[:ascii:]]/');
 eleak(2,0,'/[[.zog.]]/');
 eleak(2,0,'/[.zog.]/');
-$::TODO = 'still leaks';
 eleak(2,0,'/|\W/', '/|\W/ [perl #123198]');
-$::TODO = '';
 eleak(2,0,'no warnings; /(?[])/');
 eleak(2,0,'no warnings; /(?[[a]+[b]])/');
 eleak(2,0,'no warnings; /(?[[a]-[b]])/');

--
Perl5 Master Repository

Reply via email to