summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-01-04 01:27:55 +0000
committerArtur Bergman <sky@nanisky.com>2003-01-04 01:27:55 +0000
commit9b0189785ebb861ff80a74fea35fdf10d45b2c89 (patch)
tree65b516be22fc1ae926818d2d01d5cd7563b0f880
parent0405e91e9230dfa76b6164c6ed64f7dab29ff49a (diff)
downloadperl-9b0189785ebb861ff80a74fea35fdf10d45b2c89.tar.gz
Fix long standing memory leak with pop and shift!
p4raw-id: //depot/perl@18421
-rw-r--r--ext/threads/shared/shared.xs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs
index 2a08fb063b..c5a210f809 100644
--- a/ext/threads/shared/shared.xs
+++ b/ext/threads/shared/shared.xs
@@ -813,8 +813,9 @@ CODE:
SHARED_CONTEXT;
sv = av_pop((AV*)SHAREDSvPTR(shared));
CALLER_CONTEXT;
- ST(0) = Nullsv;
+ ST(0) = sv_newmortal();
Perl_sharedsv_associate(aTHX_ &ST(0), sv, 0);
+ SvREFCNT_dec(sv);
LEAVE_LOCK;
XSRETURN(1);
@@ -827,8 +828,9 @@ CODE:
SHARED_CONTEXT;
sv = av_shift((AV*)SHAREDSvPTR(shared));
CALLER_CONTEXT;
- ST(0) = Nullsv;
+ ST(0) = sv_newmortal();
Perl_sharedsv_associate(aTHX_ &ST(0), sv, 0);
+ SvREFCNT_dec(sv);
LEAVE_LOCK;
XSRETURN(1);