Do not leak with attribute on my variable
This commit is contained in:
parent
1cfdf84744
commit
f0eaa7691d
|
@ -0,0 +1,77 @@
|
||||||
|
From 13f27cb3dee86772eeed5d7d9b47746395ee603c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Father Chrysostomos <sprout@cpan.org>
|
||||||
|
Date: Wed, 19 Sep 2012 21:53:51 -0700
|
||||||
|
Subject: [PATCH] Stop my vars with attrs from leaking
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Ported to 5.16.1:
|
||||||
|
|
||||||
|
commit 9fa29fa7929b4167c5491b792c5cc7e4365a2839
|
||||||
|
Author: Father Chrysostomos <sprout@cpan.org>
|
||||||
|
Date: Wed Sep 19 21:53:51 2012 -0700
|
||||||
|
|
||||||
|
[perl #114764] Stop my vars with attrs from leaking
|
||||||
|
|
||||||
|
S_apply_attrs was creating a SV containing a stash name, that was
|
||||||
|
later to be put in a const op, which would take care of freeing it.
|
||||||
|
But it didn’t free it for a my variable, because the branch where that
|
||||||
|
const op was created didn’t apply. So move the creation of that SV
|
||||||
|
inside the branch that uses it, otherwise it leaks. This leak was the
|
||||||
|
result of commit 95f0a2f1ffc6.
|
||||||
|
---
|
||||||
|
op.c | 4 ++--
|
||||||
|
t/op/svleak.t | 5 ++++-
|
||||||
|
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/op.c b/op.c
|
||||||
|
index 24d5ecb..017580d 100644
|
||||||
|
--- a/op.c
|
||||||
|
+++ b/op.c
|
||||||
|
@@ -2279,13 +2279,11 @@ STATIC void
|
||||||
|
S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool for_my)
|
||||||
|
{
|
||||||
|
dVAR;
|
||||||
|
- SV *stashsv;
|
||||||
|
|
||||||
|
PERL_ARGS_ASSERT_APPLY_ATTRS;
|
||||||
|
|
||||||
|
/* fake up C<use attributes $pkg,$rv,@attrs> */
|
||||||
|
ENTER; /* need to protect against side-effects of 'use' */
|
||||||
|
- stashsv = stash ? newSVhek(HvNAME_HEK(stash)) : &PL_sv_no;
|
||||||
|
|
||||||
|
#define ATTRSMODULE "attributes"
|
||||||
|
#define ATTRSMODULE_PM "attributes.pm"
|
||||||
|
@@ -2300,6 +2298,8 @@ S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs, bool for_my)
|
||||||
|
newSVpvs(ATTRSMODULE), NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
+ SV * const stashsv =
|
||||||
|
+ stash ? newSVhek(HvNAME_HEK(stash)) : &PL_sv_no;
|
||||||
|
Perl_load_module(aTHX_ PERL_LOADMOD_IMPORT_OPS,
|
||||||
|
newSVpvs(ATTRSMODULE),
|
||||||
|
NULL,
|
||||||
|
diff --git a/t/op/svleak.t b/t/op/svleak.t
|
||||||
|
index df10953..6cfee2e 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 => 21;
|
||||||
|
+plan tests => 22;
|
||||||
|
|
||||||
|
# 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
|
||||||
|
@@ -160,3 +160,6 @@ leak(2, 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
leak(2,0,sub { !$^V }, '[perl #109762] version object in boolean context');
|
||||||
|
+
|
||||||
|
+# [perl #114764] Attributes leak scalars
|
||||||
|
+leak(2, 0, sub { eval 'my $x : shared' }, 'my $x :shared used to leak');
|
||||||
|
--
|
||||||
|
1.7.11.4
|
||||||
|
|
10
perl.spec
10
perl.spec
|
@ -29,7 +29,7 @@
|
||||||
Name: perl
|
Name: perl
|
||||||
Version: %{perl_version}
|
Version: %{perl_version}
|
||||||
# release number must be even higher, because dual-lived modules will be broken otherwise
|
# release number must be even higher, because dual-lived modules will be broken otherwise
|
||||||
Release: 237%{?dist}
|
Release: 238%{?dist}
|
||||||
Epoch: %{perl_epoch}
|
Epoch: %{perl_epoch}
|
||||||
Summary: Practical Extraction and Report Language
|
Summary: Practical Extraction and Report Language
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
|
@ -98,6 +98,9 @@ Patch14: perl-5.16.1-perl-113980-pp_syscall-I32-retval-truncates-the-retu
|
||||||
# podlators-2.4.1
|
# podlators-2.4.1
|
||||||
Patch15: perl-5.14.2-Override-the-Pod-Simple-parse_file.patch
|
Patch15: perl-5.14.2-Override-the-Pod-Simple-parse_file.patch
|
||||||
|
|
||||||
|
# Do not leak with attribute on my variable, rhbz#858966, RT#114764,
|
||||||
|
# fixed after 5.17.4
|
||||||
|
Patch16: perl-5.16.1-perl-114764-Stop-my-vars-with-attrs-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
|
||||||
|
@ -1358,6 +1361,7 @@ tarball from perl.org.
|
||||||
%patch13 -p1
|
%patch13 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
|
||||||
#copy the example script
|
#copy the example script
|
||||||
cp -a %{SOURCE5} .
|
cp -a %{SOURCE5} .
|
||||||
|
@ -1565,6 +1569,7 @@ pushd %{build_archlib}/CORE/
|
||||||
'Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)' \
|
'Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)' \
|
||||||
'Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)' \
|
'Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)' \
|
||||||
'Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)' \
|
'Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)' \
|
||||||
|
'Fedora Patch16: Do not leak with attribute on my variable (RT#114764)' \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
rm patchlevel.bak
|
rm patchlevel.bak
|
||||||
|
@ -2709,6 +2714,9 @@ sed \
|
||||||
|
|
||||||
# Old changelog entries are preserved in CVS.
|
# Old changelog entries are preserved in CVS.
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 21 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-238
|
||||||
|
- Do not leak with attribute on my variable (bug #858966)
|
||||||
|
|
||||||
* Thu Sep 20 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-237
|
* Thu Sep 20 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-237
|
||||||
- Put perl-podlators into perl-core list (bug #856516)
|
- Put perl-podlators into perl-core list (bug #856516)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue