In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/b573e7000fd9c1cfae30ae5fb328a25b9bf3870a?hp=7a278470580a96e01c6545304d787761ea9d8c80>

- Log -----------------------------------------------------------------
commit b573e7000fd9c1cfae30ae5fb328a25b9bf3870a
Author: Father Chrysostomos <[email protected]>
Date:   Thu Jun 6 14:14:06 2013 -0700

    Don’t leak when compiling /(?[\d\d])/
    
    The ‘Operand with no preceding operator’ error was leaking the last
    two operands.

M       regcomp.c
M       t/op/svleak.t

commit 4bc5d08976b7df23b63a56cc017a20ac5766fbbc
Author: Father Chrysostomos <[email protected]>
Date:   Thu Jun 6 14:07:21 2013 -0700

    Free operand when encountering unmatched ')' in (?[])
    
    I only need to free the operand (current), not the left-paren token
    that turns out not to be a paren (lparen).
    
    For lparen to leak, there would have to be two operands in a row on
    the charclass parsing stack, which currently never happens.

M       regcomp.c
M       t/op/svleak.t

commit c80d037c54749655d40eac068936c5222ce9d8ee
Author: Father Chrysostomos <[email protected]>
Date:   Thu Jun 6 13:42:32 2013 -0700

    Stop /(?[\p{...}])/ compilation from leaking
    
    The swash returned by utf8_heavy.pl was not being freed in the code
    path to handle returning character classes to the (?[...]) parser
    (when ret_invlist is true).

M       regcomp.c
M       t/op/svleak.t
-----------------------------------------------------------------------

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

diff --git a/regcomp.c b/regcomp.c
index 1812028..173fd6c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -11949,6 +11949,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, 
SV** return_invlist, I32 *f
                     || IS_OPERAND(lparen)
                     || SvUV(lparen) != '(')
                 {
+                    SvREFCNT_dec(current);
                     RExC_parse++;
                     vFAIL("Unexpected ')'");
                 }
@@ -11971,6 +11972,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, 
SV** return_invlist, I32 *f
                     char current_operator;
 
                     if (IS_OPERAND(top)) {
+                        SvREFCNT_dec_NN(top);
+                        SvREFCNT_dec_NN(current);
                         vFAIL("Operand with no preceding operator");
                     }
                     current_operator = (char) SvUV(top);
@@ -13724,6 +13727,7 @@ parseit:
 
     if (ret_invlist) {
         *ret_invlist = cp_list;
+        SvREFCNT_dec(swash);
 
         /* Discard the generated node */
         if (SIZE_ONLY) {
diff --git a/t/op/svleak.t b/t/op/svleak.t
index b97a5cb..71bfbb7 100644
--- a/t/op/svleak.t
+++ b/t/op/svleak.t
@@ -15,7 +15,7 @@ BEGIN {
 
 use Config;
 
-plan tests => 121;
+plan tests => 124;
 
 # 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
@@ -247,6 +247,9 @@ eleak(2,0,'no warnings; /(?[[a]&[b]])/');
 eleak(2,0,'no warnings; /(?[[a]|[b]])/');
 eleak(2,0,'no warnings; /(?[[a]^[b]])/');
 eleak(2,0,'no warnings; /(?[![a]])/');
+eleak(2,0,'no warnings; /(?[\p{Word}])/');
+eleak(2,0,'no warnings; /(?[[a]+)])/');
+eleak(2,0,'no warnings; /(?[\d\d)])/');
 
 # These can generate one ref count, but just  once.
 eleak(4,1,'chr(0x100) =~ /[[:punct:]]/');

--
Perl5 Master Repository

Reply via email to