summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-02-07 10:07:27 -0500
committerGurusamy Sarathy <gsar@cpan.org>1999-02-07 23:26:04 +0000
commit4327152a8da835b489f2314100b405920cc614ea (patch)
tree7482bd3f3e844d5ca29fab8fecd5d7f0301d5a37 /regcomp.c
parent1ae175c8d48ec3f9bff4739583753d9b46939a5f (diff)
downloadperl-4327152a8da835b489f2314100b405920cc614ea.tar.gz
patch for change#2822, done right; add PERL_OBJECT stuff; regen headers
Message-ID: <19990207150726.A571@monk.mps.ohio-state.edu> Subject: Re: fixing memory leaks in REx compilation p4raw-link: @2822 on //depot/perl: 34184a49c8a0771dbea73b3f0519126fd5b22c2f p4raw-id: //depot/perl@2826
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index f78388b827..91f9d7b5fc 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -147,6 +147,7 @@ static char* regwhite _((char *, char *));
static char* nextchar _((void));
static void re_croak2 _((const char* pat1,const char* pat2,...)) __attribute__((noreturn));
static char* regpposixcc _((I32 value));
+static void clear_re _((void *r));
#endif
/* Length of a variant. */
@@ -207,6 +208,12 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#define CHR_DIST(a,b) (UTF ? utf8_distance(a,b) : a - b)
STATIC void
+clear_re(void *r)
+{
+ ReREFCNT_dec((regexp *)r);
+}
+
+STATIC void
scan_commit(scan_data_t *data)
{
dTHR;
@@ -868,7 +875,12 @@ pregcomp(char *exp, char *xend, PMOP *pm)
r->prelen = xend - exp;
r->precomp = PL_regprecomp;
r->subbeg = r->subbase = NULL;
- r->nparens = PL_regnpar - 1; /* set early to validate backrefs */
+ r->nparens = PL_regnpar - 1; /* set early to validate backrefs */
+
+ r->substrs = 0; /* Useful during FAIL. */
+ r->startp = 0; /* Useful during FAIL. */
+ r->endp = 0; /* Useful during FAIL. */
+
PL_regcomp_rx = r;
/* Second pass: emit code. */