From 89900bd3f9798cf0a5e524a809c7f1bb1b066fa2 Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Wed, 31 Jul 2002 11:50:06 +0200 Subject: Re: [perl #15523] Memory Leak in split with trailing empty elements Message-id: <87ado85ob5.fsf@vran.herceg.de> p4raw-id: //depot/perl@17696 --- pp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pp.c b/pp.c index 7fa9c06933..d7fc6bfc52 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) { -- cgit v1.2.1