From: Dave Mitchell Date: Sat, 26 Feb 2005 00:47:03 +0000 (+0000) Subject: Fix leaks in List::Util::reduce,first X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=49ce4d3149169150fd3bcc3a0a4e9505dd47ab5e;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/ext/List/Util/Util.xs b/ext/List/Util/Util.xs index 1a996f5..81e35cf 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 e2bbb5c..089a436 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 {