summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2015-07-29 03:31:23 -0400
committerTony Cook <tony@develop-help.com>2015-08-03 11:50:54 +1000
commit997c424a5725c6a1ddfcced6f5d13535e970f842 (patch)
tree968e36f2ccaacdb6ee4ddf8d90b4ca67e2a8756e /regcomp.c
parentc0b7e5912401cf8f1eedc72206b90e6f1623729a (diff)
downloadperl-997c424a5725c6a1ddfcced6f5d13535e970f842.tar.gz
Safefree(NULL) reduction
locale.c: - the pointers are always null at this point, see http://www.nntp.perl.org/group/perl.perl5.porters/2015/07/msg229533.html pp.c: - reduce scope of temp_buffer and svrecode, into an inner branch - in some permutations, either temp_buffer is never set to non-null, or svrecode, in permutations where it is known that the var hasn't been set yet, skip the freeing calls at the end, this doesn't eliminate all permutations with NULL being passed to Safefree and SvREFCNT_dec, but only some of them regcomp.c - dont create a save stack entry to call Safefree(NULL), see ticket for this patch for some profiling stats
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 901e2c0846..f08f08ff4a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6757,7 +6757,8 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
for (n = 0; n < pRExC_state->num_code_blocks; n++)
if (pRExC_state->code_blocks[n].src_regex)
SAVEFREESV(pRExC_state->code_blocks[n].src_regex);
- SAVEFREEPV(pRExC_state->code_blocks);
+ if(pRExC_state->code_blocks)
+ SAVEFREEPV(pRExC_state->code_blocks); /* often null */
}
{