From: Slaven Rezic Date: Wed, 31 Jul 2002 09:50:06 +0000 (+0200) Subject: Re: [perl #15523] Memory Leak in split with trailing empty elements X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89900bd3f9798cf0a5e524a809c7f1bb1b066fa2;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #15523] Memory Leak in split with trailing empty elements Message-id: <87ado85ob5.fsf@vran.herceg.de> p4raw-id: //depot/perl@17696 --- diff --git a/pp.c b/pp.c index 7fa9c06..d7fc6bf 100644 --- a/pp.c +++ b/pp.c @@ -4611,8 +4611,12 @@ PP(pp_split) iters++; } else if (!origlimit) { - while (iters > 0 && (!TOPs || !SvANY(TOPs) || SvCUR(TOPs) == 0)) - iters--, SP--; + while (iters > 0 && (!TOPs || !SvANY(TOPs) || SvCUR(TOPs) == 0)) { + if (TOPs && !make_mortal) + sv_2mortal(TOPs); + iters--; + SP--; + } } if (realarray) {