This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fwd: Memory leak with s/// and hashes
authorYves Orton <demerphq@gmail.com>
Tue, 14 Nov 2006 00:38:31 +0000 (01:38 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 14 Nov 2006 09:36:17 +0000 (09:36 +0000)
Message-ID: <9b18b3110611131538kc00175ft4db7ff71df22e766@mail.gmail.com>

p4raw-id: //depot/perl@29268

regcomp.c
regexec.c
regexp.h

index b077ddb..9099194 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4483,7 +4483,6 @@ reStudy:
     Newxz(r->startp, RExC_npar, I32);
     Newxz(r->endp, RExC_npar, I32);
     
-    DEBUG_r( RX_DEBUG_on(r) );
     DEBUG_DUMP_r({
         PerlIO_printf(Perl_debug_log,"Final program:\n");
         regdump(r);
@@ -8375,8 +8374,8 @@ Perl_pregfree(pTHX_ struct regexp *r)
     DEBUG_COMPILE_r({
        if (!PL_colorset)
            reginitcolors();
-       if (RX_DEBUG(r)){
-            SV *dsv= sv_newmortal();
+       {
+           SV *dsv= sv_newmortal();
             RE_PV_QUOTED_DECL(s, (r->reganch & ROPT_UTF8),
                 dsv, r->precomp, r->prelen, 60);
             PerlIO_printf(Perl_debug_log,"%sFreeing REx:%s %s\n", 
@@ -8485,12 +8484,10 @@ Perl_pregfree(pTHX_ struct regexp *r)
                         if (trie->nextword)
                             Safefree(trie->nextword);
 #ifdef DEBUGGING
-                        if (RX_DEBUG(r)) {
-                            if (trie->words)
-                                SvREFCNT_dec((SV*)trie->words);
-                            if (trie->revcharmap)
-                                SvREFCNT_dec((SV*)trie->revcharmap);
-                        }
+                        if (trie->words)
+                            SvREFCNT_dec((SV*)trie->words);
+                        if (trie->revcharmap)
+                            SvREFCNT_dec((SV*)trie->revcharmap);
 #endif
                         Safefree(r->data->data[n]); /* do this last!!!! */
                    }
index 2470821..a0637a8 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -2902,9 +2902,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                DEBUG_EXECUTE_r({
                    reg_trie_data * const trie
                        = (reg_trie_data*)rex->data->data[ ARG(ST.me) ];
-                   SV ** const tmp = RX_DEBUG(reginfo->prog)
-                                   ? av_fetch( trie->words, ST.accept_buff[ 0 ].wordnum-1, 0 )
-                                   : NULL;
+                   SV ** const tmp = av_fetch( trie->words, 
+                       ST.accept_buff[ 0 ].wordnum-1, 0 );
                    PerlIO_printf( Perl_debug_log,
                        "%*s  %sonly one match left: #%d <%s>%s\n",
                        REPORT_CODE_OFF+depth*2, "", PL_colors[4],
@@ -2978,9 +2977,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
                DEBUG_EXECUTE_r({
                    reg_trie_data * const trie
                        = (reg_trie_data*)rex->data->data[ ARG(ST.me) ];
-                   SV ** const tmp = RX_DEBUG(reginfo->prog)
-                               ? av_fetch( trie->words, ST.accept_buff[ best ].wordnum - 1, 0 )
-                               : NULL;
+                   SV ** const tmp = av_fetch( trie->words, 
+                       ST.accept_buff[ best ].wordnum - 1, 0 );
                    regnode *nextop=(!ST.jump || !ST.jump[ST.accept_buff[best].wordnum]) ? 
                                    ST.B : 
                                    ST.me + ST.jump[ST.accept_buff[best].wordnum];    
index f71aefa..8d08682 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -143,10 +143,6 @@ typedef struct regexp_engine {
 
 /* Stuff that needs to be included in the plugable extension goes below here */
 
-#define RE_DEBUG_BIT            0x20000000
-#define RX_DEBUG(prog) ((prog)->reganch & RE_DEBUG_BIT)
-#define RX_DEBUG_on(prog) ((prog)->reganch |= RE_DEBUG_BIT)
-
 #ifdef PERL_OLD_COPY_ON_WRITE
 #define RX_MATCH_COPY_FREE(rx) \
        STMT_START {if (rx->saved_copy) { \