Stop !$^V from leaking

This commit is contained in:
Petr Písař 2012-02-06 16:05:19 +01:00
parent d62ea48571
commit a47d864e3a
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,54 @@
From 8ee4f541d4632a3615e70e177e004c5db970c8cd Mon Sep 17 00:00:00 2001
From: Father Chrysostomos <sprout@cpan.org>
Date: Fri, 3 Feb 2012 21:55:31 -0800
Subject: [PATCH] Stop !$^V from leaking
by mortalising the temporary SVs.
Petr Pisar: Back-port for 5.14.2.
---
t/op/svleak.t | 4 +++-
universal.c | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/t/op/svleak.t b/t/op/svleak.t
index 5eb090c..0f4348e 100644
--- a/t/op/svleak.t
+++ b/t/op/svleak.t
@@ -13,7 +13,7 @@ BEGIN {
or skip_all("XS::APItest not available");
}
-plan tests => 19;
+plan tests => 20;
# run some code N times. If the number of SVs at the end of loop N is
# greater than (N-1)*delta at the end of loop 1, we've got a leak
@@ -141,3 +141,5 @@ leak(2, 0,
},
"rcatline leak"
);
+
+leak(2,0,sub { !$^V }, '[perl #109762] version object in boolean context');
diff --git a/universal.c b/universal.c
index 092ee80..9615d59 100644
--- a/universal.c
+++ b/universal.c
@@ -544,7 +544,13 @@ XS(XS_version_boolean)
SP -= items;
if (sv_derived_from(ST(0), "version") && SvROK(ST(0))) {
SV * const lobj = SvRV(ST(0));
- SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvs("0"))) );
+ SV * const rs =
+ newSViv( vcmp(lobj,
+ sv_2mortal(new_version(
+ sv_2mortal(newSVpvs("0"))
+ ))
+ )
+ );
mPUSHs(rs);
PUTBACK;
return;
--
1.7.7.6

View File

@ -92,6 +92,9 @@ Patch13: perl-5.14.2-locale-search-inc.patch
# rhbz#771228, RT#107216, fixed after 5.15.6. # rhbz#771228, RT#107216, fixed after 5.15.6.
Patch14: perl-5.14.2-Signal-handlers-must-run-before-sigsuspend-returns.patch Patch14: perl-5.14.2-Signal-handlers-must-run-before-sigsuspend-returns.patch
# Stop !$^V from leaking, rhbz#787613, RT#109762, fixed after 5.15.7.
Patch15: perl-5.14.2-Stop-V-from-leaking.patch
# Update some of the bundled modules # Update some of the bundled modules
# see http://fedoraproject.org/wiki/Perl/perl.spec for instructions # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
@ -1258,6 +1261,7 @@ tarball from perl.org.
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch15 -p1
#copy the example script #copy the example script
cp -a %{SOURCE5} . cp -a %{SOURCE5} .
@ -1462,6 +1466,7 @@ pushd %{build_archlib}/CORE/
'Fedora Patch12: Fix interrupted reading' \ 'Fedora Patch12: Fix interrupted reading' \
'Fedora Patch13: Fix searching for Unicode::Collate::Locale data' \ 'Fedora Patch13: Fix searching for Unicode::Collate::Locale data' \
'Fedora Patch14: Run signal handlers before returning from sigsuspend' \ 'Fedora Patch14: Run signal handlers before returning from sigsuspend' \
'Fedora Patch15: Stop !$^V from leaking' \
%{nil} %{nil}
rm patchlevel.bak rm patchlevel.bak
@ -2414,6 +2419,7 @@ sed \
- Run safe signal handlers before returning from sigsuspend() and pause() - Run safe signal handlers before returning from sigsuspend() and pause()
(bug #771228) (bug #771228)
- Correct perl-Scalar-List-Utils files list - Correct perl-Scalar-List-Utils files list
- Stop !$^V from leaking (bug #787613)
* Tue Jan 10 2012 Paul Howarth <paul@city-fan.org> - 4:5.14.2-210 * Tue Jan 10 2012 Paul Howarth <paul@city-fan.org> - 4:5.14.2-210
- Rebuild again now that perl dependency generator is fixed (#772632, #772699) - Rebuild again now that perl dependency generator is fixed (#772632, #772699)