Message-ID: <Pine.LNX.4.21.
0108031730040.23972-100000@mako.covalent.net>
p4raw-id: //depot/perl@11567
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);
}
}
#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);