summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-01-03 02:20:28 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-01-03 02:20:28 +0000
commit34394ecd06e704e9000dad1c98dea7dea737c4ea (patch)
tree4f39da0d9cb4be2c90daf0b7fbcbb697f9d49e48 /sv.c
parent679c1196bc547e94f05d35e070242e24492ec832 (diff)
downloadperl-34394ecd06e704e9000dad1c98dea7dea737c4ea.tar.gz
ithreads: SVs that were only on the tmps stack leaked
p4raw-id: //depot/perl@26591
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 9cc9c370d4..d32bd99c36 100644
--- a/sv.c
+++ b/sv.c
@@ -10767,6 +10767,20 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
else {
init_stacks();
ENTER; /* perl_destruct() wants to LEAVE; */
+
+ /* although we're not duplicating the tmps stack, we should still
+ * add entries for any SVs on the tmps stack that got cloned by a
+ * non-refcount means (eg a temp in @_); otherwise they will be
+ * orphaned
+ */
+ for (i = 0; i<= proto_perl->Ttmps_ix; i++) {
+ SV *nsv = (SV*)ptr_table_fetch(PL_ptr_table,
+ proto_perl->Ttmps_stack[i]);
+ if (nsv && !SvREFCNT(nsv)) {
+ EXTEND_MORTAL(1);
+ PL_tmps_stack[++PL_tmps_ix] = SvREFCNT_inc(nsv);
+ }
+ }
}
PL_start_env = proto_perl->Tstart_env; /* XXXXXX */