summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@covalent.net>2001-08-03 11:17:41 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-04 14:08:19 +0000
commit9b978d731dbdb96e716e0b0959a0135ca6805247 (patch)
treeaed45875cb072e5ad6c4f5716a4708674f9014db /regcomp.c
parent35061a7e2b3411cdebe03b5b73528a18647b44f9 (diff)
downloadperl-9b978d731dbdb96e716e0b0959a0135ca6805247.tar.gz
[patch] refcount re ops
Message-ID: <Pine.LNX.4.21.0108031814240.23972-100000@mako.covalent.net> p4raw-id: //depot/perl@11568
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index cdf42f5ccd..fb6b9c532b 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2138,6 +2138,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp)
ENTER;
Perl_save_re_context(aTHX);
rop = sv_compile_2op(sv, &sop, "re", &av);
+ sop->op_private |= OPpREFCOUNTED;
+ /* re_dup will OpREFCNT_inc */
+ OpREFCNT_set(sop, 1);
LEAVE;
n = add_data(pRExC_state, 3, "nop");
@@ -4609,7 +4612,11 @@ Perl_pregfree(pTHX_ struct regexp *r)
}
else
PL_curpad = NULL;
- op_free((OP_4tree*)r->data->data[n]);
+
+ if (!OpREFCNT_dec((OP_4tree*)r->data->data[n])) {
+ op_free((OP_4tree*)r->data->data[n]);
+ }
+
PL_comppad = old_comppad;
PL_curpad = old_curpad;
SvREFCNT_dec((SV*)new_comppad);