summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-14 03:50:38 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-14 03:50:38 +0000
commit5cfc78421f161e223f47fcc0aa3d4d3fa5f3976e (patch)
tree2ef2cd4539bb6af01a562976c217e5ddfe2089a4 /regcomp.c
parentc6a6ba88b188e56556e838218408788ec13954d4 (diff)
downloadperl-5cfc78421f161e223f47fcc0aa3d4d3fa5f3976e.tar.gz
Integrate changes #9137,9138,9142 from maintperl into mainline.
fix leak in pregcomp() when RE fails to compile (e.g. m/\\/) remove squelch controls for "Scalars leaked" messages in most places (these are now cured) fix another memory leak reported by purify (tie callbacks that croak can leak when wiping out magic) p4raw-link: @9142 on //depot/maint-5.6/perl: 26972843796e21c404c9d13ec5ee86e7b952a2bd p4raw-link: @9138 on //depot/maint-5.6/perl: ad7f1144250940f9ca43bac32708ec5e718b30ff p4raw-link: @9137 on //depot/maint-5.6/perl: 1f35595ecca168b4f66e3399344799fdbd496d17 p4raw-id: //depot/perl@9144 p4raw-integrated: from //depot/maint-5.6/perl@9143 'copy in' t/pragma/strict-vars (@7318..) t/pragma/warn/regcomp (@7887..) t/op/regexp.t (@8551..) t/op/lex_assign.t (@8987..) 'merge in' t/op/local.t (@5902..) t/pragma/warn/op (@7846..) t/pragma/warnings.t (@7895..) t/comp/proto.t (@8173..) t/pragma/warn/toke (@8570..) regcomp.c (@8777..) scope.c (@8855..) t/op/pat.t (@9076..)
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index 4638d77047..19ad253929 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -1599,7 +1599,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
else
RExC_utf8 = 0;
- RExC_precomp = savepvn(exp, xend - exp);
+ RExC_precomp = exp;
DEBUG_r(if (!PL_colorset) reginitcolors());
DEBUG_r(PerlIO_printf(Perl_debug_log, "%sCompiling REx%s `%s%*s%s'\n",
PL_colors[4],PL_colors[5],PL_colors[0],
@@ -1625,7 +1625,6 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
REGC((U8)REG_MAGIC, (char*)RExC_emit);
#endif
if (reg(pRExC_state, 0, &flags) == NULL) {
- Safefree(RExC_precomp);
RExC_precomp = Nullch;
return(NULL);
}
@@ -1652,7 +1651,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
#endif
r->refcnt = 1;
r->prelen = xend - exp;
- r->precomp = RExC_precomp;
+ r->precomp = savepvn(RExC_precomp, r->prelen);
r->subbeg = NULL;
r->reganch = pm->op_pmflags & PMf_COMPILETIME;
r->nparens = RExC_npar - 1; /* set early to validate backrefs */