diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2005-02-26 00:47:03 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-02-26 00:47:03 +0000 |
commit | 49ce4d3149169150fd3bcc3a0a4e9505dd47ab5e (patch) | |
tree | 0b2ef739ee7d400b5428823204fccd6fa02eab3c /ext/List | |
parent | 7205a85d1570b13acf2f59aa0811bf1eb6b3fc0e (diff) | |
download | perl-49ce4d3149169150fd3bcc3a0a4e9505dd47ab5e.tar.gz |
Fix leaks in List::Util::reduce,first
When the block is a closure, the cloned CV created on each call
was never freed
p4raw-id: //depot/perl@23996
Diffstat (limited to 'ext/List')
-rw-r--r-- | ext/List/Util/Util.xs | 5 | ||||
-rw-r--r-- | ext/List/Util/lib/Scalar/Util.pm | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/ext/List/Util/Util.xs b/ext/List/Util/Util.xs index 1a996f5cc7..81e35cfd29 100644 --- a/ext/List/Util/Util.xs +++ b/ext/List/Util/Util.xs @@ -250,6 +250,7 @@ CODE: } ST(0) = ret; POPBLOCK(cx,PL_curpm); + LEAVESUB(cv); CATCH_SET(oldcatch); XSRETURN(1); } @@ -290,8 +291,6 @@ CODE: CATCH_SET(TRUE); PUSHBLOCK(cx, CXt_SUB, SP); PUSHSUB(cx); - if (!CvDEPTH(cv)) - (void)SvREFCNT_inc(cv); for(index = 1 ; index < items ; index++) { GvSV(PL_defgv) = ST(index); @@ -300,11 +299,13 @@ CODE: if (SvTRUE(*PL_stack_sp)) { ST(0) = ST(index); POPBLOCK(cx,PL_curpm); + LEAVESUB(cv); CATCH_SET(oldcatch); XSRETURN(1); } } POPBLOCK(cx,PL_curpm); + LEAVESUB(cv); CATCH_SET(oldcatch); XSRETURN_UNDEF; } diff --git a/ext/List/Util/lib/Scalar/Util.pm b/ext/List/Util/lib/Scalar/Util.pm index e2bbb5c0bc..089a43609a 100644 --- a/ext/List/Util/lib/Scalar/Util.pm +++ b/ext/List/Util/lib/Scalar/Util.pm @@ -11,7 +11,7 @@ require List::Util; # List::Util loads the XS @ISA = qw(Exporter); @EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype); -$VERSION = "1.14"; +$VERSION = "1.14_1"; $VERSION = eval $VERSION; sub export_fail { |