This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid allocating 1 extra regnode when duplicating a regexp.
authorNicholas Clark <nick@ccl4.org>
Sun, 5 Oct 2008 21:51:54 +0000 (21:51 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 5 Oct 2008 21:51:54 +0000 (21:51 +0000)
See http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-09/msg00590.html
and http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-10/msg00163.html

p4raw-id: //depot/perl@34464

regcomp.c

index d2567d0..54347cc 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -9625,7 +9625,7 @@ Perl_regdupe_internal(pTHX_ REGEXP * const rx, CLONE_PARAMS *param)
     npar = r->nparens+1;
     len = ProgLen(ri);
     
-    Newxc(reti, sizeof(regexp_internal) + (len+1)*sizeof(regnode), char, regexp_internal);
+    Newxc(reti, sizeof(regexp_internal) + len*sizeof(regnode), char, regexp_internal);
     Copy(ri->program, reti->program, len+1, regnode);