From: Doug MacEachern Date: Fri, 3 Aug 2001 17:37:53 +0000 (-0700) Subject: [patch] ignore PL_curpm in PL_regex_padav cleanup X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=35061a7e2b3411cdebe03b5b73528a18647b44f9;p=p5sagit%2Fp5-mst-13.2.git [patch] ignore PL_curpm in PL_regex_padav cleanup Message-ID: p4raw-id: //depot/perl@11567 --- diff --git a/perl.c b/perl.c index 7362316..b3d1e31 100644 --- a/perl.c +++ b/perl.c @@ -477,8 +477,16 @@ perl_destruct(pTHXx) SV **ary = AvARRAY(PL_regex_padav); while (i) { - REGEXP *re = (REGEXP *)SvIVX(ary[--i]); - if (re && (re->refcnt > 0)) { + SV *resv = ary[--i]; + REGEXP *re = (REGEXP *)SvIVX(resv); + + if (SvFLAGS(resv) & SVf_BREAK) { + /* this is PL_curpm, already freed + * flag is set in regexec.c:S_regtry + */ + SvFLAGS(resv) &= ~SVf_BREAK; + } + else { ReREFCNT_dec(re); } } diff --git a/regexec.c b/regexec.c index 31a1c6a..ceed381 100644 --- a/regexec.c +++ b/regexec.c @@ -1855,6 +1855,8 @@ S_regtry(pTHX_ regexp *prog, char *startpos) #ifdef USE_ITHREADS { SV* repointer = newSViv(0); + /* so we know which PL_regex_padav element is PL_curpm */ + SvFLAGS(repointer) |= SVf_BREAK; av_push(PL_regex_padav,repointer); PL_reg_curpm->op_pmoffset = av_len(PL_regex_padav); PL_regex_pad = AvARRAY(PL_regex_padav);