summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2002-07-31 11:50:06 +0200
committerhv <hv@crypt.org>2002-08-08 14:44:21 +0000
commit89900bd3f9798cf0a5e524a809c7f1bb1b066fa2 (patch)
tree32c1341a179f9532236a67cdc96229b07569224e /pp.c
parent6b78add2c35f54b36819625ba31bac03f6bb28ea (diff)
downloadperl-89900bd3f9798cf0a5e524a809c7f1bb1b066fa2.tar.gz
Re: [perl #15523] Memory Leak in split with trailing empty elements
Message-id: <87ado85ob5.fsf@vran.herceg.de> p4raw-id: //depot/perl@17696
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files 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) {