summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@covalent.net>2001-08-02 13:24:55 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-03 12:09:50 +0000
commit5f8cb0464db8019389b7bf1816b817fa4d44ca34 (patch)
treedf56724573529c8bbcedb239c398ae4f2abeb257 /perl.c
parentbc0a45ed05a5ed25882d9d65d5140ab818bd1fbf (diff)
downloadperl-5f8cb0464db8019389b7bf1816b817fa4d44ca34.tar.gz
[patch] plug PL_regex_padav leaks
Message-ID: <Pine.LNX.4.21.0108022020100.8991-100000@mako.covalent.net> p4raw-id: //depot/perl@11560
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index e6d6f5f28b..73623165aa 100644
--- a/perl.c
+++ b/perl.c
@@ -466,6 +466,28 @@ perl_destruct(pTHXx)
}
#endif
+#ifdef USE_ITHREADS
+ /* the syntax tree is shared between clones
+ * so op_free(PL_main_root) only ReREFCNT_dec's
+ * REGEXPs in the parent interpreter
+ * we need to manually ReREFCNT_dec for the clones
+ */
+ {
+ I32 i = AvFILLp(PL_regex_padav) + 1;
+ SV **ary = AvARRAY(PL_regex_padav);
+
+ while (i) {
+ REGEXP *re = (REGEXP *)SvIVX(ary[--i]);
+ if (re && (re->refcnt > 0)) {
+ ReREFCNT_dec(re);
+ }
+ }
+ }
+ SvREFCNT_dec(PL_regex_padav);
+ PL_regex_padav = Nullav;
+ PL_regex_pad = NULL;
+#endif
+
/* loosen bonds of global variables */
if(PL_rsfp) {