[perl/f13/master] Do not leak when destroying thread

Petr Pisar ppisar at fedoraproject.org
Mon Sep 6 16:18:53 UTC 2010


commit 718ab29133f2a8509a6b4ca69ee52e05bbb5fcc7
Author: Petr Písař <ppisar at redhat.com>
Date:   Mon Sep 6 18:17:39 2010 +0200

    Do not leak when destroying thread
    
    RT #77352, RHBZ #630667
    Fix picked from blead upstream git branch up.

 perl-5.10.1-fix_thread_leak.patch |   71 +++++++++++++++++++++++++++++++++++++
 perl.spec                         |   10 +++++-
 2 files changed, 80 insertions(+), 1 deletions(-)
---
diff --git a/perl-5.10.1-fix_thread_leak.patch b/perl-5.10.1-fix_thread_leak.patch
new file mode 100644
index 0000000..79d7188
--- /dev/null
+++ b/perl-5.10.1-fix_thread_leak.patch
@@ -0,0 +1,71 @@
+commit 3b74121464fd7626369d93a3f9820f1189bd9374
+Author: Jirka Hruška <jirka at fud.cz>
+Date:   Wed Sep 1 11:18:43 2010 +0100
+
+    PL_my_cxt_list leaks
+    
+    [perl #77352]
+    
+    PL_my_cxt_list was never freed
+
+diff --git a/perl.c b/perl.c
+index 94f2b13..8f2a024 100644
+--- a/perl.c
++++ b/perl.c
+@@ -1151,6 +1151,10 @@ perl_destruct(pTHXx)
+ 		 (long)cxstack_ix + 1);
+     }
+ 
++    /* the entries in this list are allocated via SV PVX's, so get freed
++     * in sv_clean_all */
++    Safefree(PL_my_cxt_list);
++
+     /* Now absolutely destruct everything, somehow or other, loops or no. */
+ 
+     /* the 2 is for PL_fdpid and PL_strtab */
+
+commit c3a99e6d9c4de88ee9b7231b755b7d4f2a3e98a3
+Author: Jirka Hruška <jirka at fud.cz>
+Date:   Wed Sep 1 10:59:35 2010 +0100
+
+    Memory leak cloning PVGVs
+    
+    [perl #77352]
+    
+    In S_sv_dup_common, Perl_rvpv_dup was called twice on a non-GP PVGV value,
+    causing the first duped value to be leaked
+
+diff --git a/AUTHORS b/AUTHORS
+index 780386b..1a11b90 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -476,6 +476,7 @@ Jim Meyering			<meyering at asic.sc.ti.com>
+ Jim Miner			<jfm at winternet.com>
+ Jim Richardson
+ Jim Schneider			<jschneid at netilla.com>
++Jirka Hruška			<jirka at fud.cz>
+ Joachim Huober
+ Jochen Wiedmann			<joe at ispsoft.de>
+ Jody Belka			<dev-perl at pimb.org>
+diff --git a/sv.c b/sv.c
+index d2fcb0c..f0287a5 100644
+--- a/sv.c
++++ b/sv.c
+@@ -10691,6 +10691,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
+ 		else
+ 		    LvTARG(dstr) = sv_dup_inc(LvTARG(dstr), param);
+ 	    case SVt_PVGV:
++		/* non-GP case already handled above */
+ 		if(isGV_with_GP(sstr)) {
+ 		    GvNAME_HEK(dstr) = hek_dup(GvNAME_HEK(dstr), param);
+ 		    /* Don't call sv_add_backref here as it's going to be
+@@ -10701,8 +10702,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
+ 		    GvSTASH(dstr) = hv_dup(GvSTASH(dstr), param);
+ 		    GvGP(dstr)	= gp_dup(GvGP(sstr), param);
+ 		    (void)GpREFCNT_inc(GvGP(dstr));
+-		} else
+-		    Perl_rvpv_dup(aTHX_ dstr, sstr, param);
++		}
+ 		break;
+ 	    case SVt_PVIO:
+ 		IoIFP(dstr)	= fp_dup(IoIFP(dstr), IoTYPE(dstr), param);
diff --git a/perl.spec b/perl.spec
index 44693f1..281f3f4 100644
--- a/perl.spec
+++ b/perl.spec
@@ -8,7 +8,7 @@
 
 Name:           perl
 Version:        %{perl_version}
-Release:        118%{?dist}
+Release:        119%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -82,6 +82,9 @@ Patch14:        perl-5.10.1-unpack-didn-t-handle-scalar-context.patch
 # Fix IO tests to allow parallel testing
 Patch15:        perl-5.10.1-IO-isolate_tests.patch
 
+# Do not leak when destroying thread; RT #77352, RHBZ #630667
+Patch16:        perl-5.10.1-fix_thread_leak.patch
+
 # Version macros for some of the modules.
 # If comment starts with module name, distributed module is part of
 # perl bundle. Otherwise it belongs to module version macro
@@ -914,6 +917,7 @@ upstream tarball from perl.org.
 %patch13 -p1
 %patch14 -p1
 %patch15 -p1
+%patch16 -p1
 
 %patch101 -p1
 %patch102 -p1
@@ -1137,6 +1141,7 @@ pushd %{build_archlib}/CORE/
     'Fedora Patch13: CVE_2009_3626' \
     'Fedora Patch14: unpack RT 73814' \
     'Fedora Patch15: enable parallel tests of IO module' \
+    'Fedora Patch16: Do not leak when destroying thread; RT #77352' \
 	'Fedora Patch101: Update ExtUtils::CBuilder to %{ExtUtils_CBuilder_version}' \
 	'Fedora Patch102: Update File::Path to %{File_Path_version}' \
 	'Fedora Patch103: Update Module::Build to %{Module_Build_version}' \
@@ -1805,6 +1810,9 @@ rm -rf $RPM_BUILD_ROOT
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Mon Sep 06 2010 Petr Pisar <ppisar at redhat.com> - 4:5.10.1-119
+- Do not leak when destroying thread (RT #77352, RHBZ #630667)
+
 * Wed Aug 19 2010 Petr Pisar <ppisar at redhat.com> - 4:5.10.1-118
 - Add "-Wl,--enable-new-dtags" to linker to allow to override perl's rpath by
   LD_LIBRARY_PATH used in tests. Otherwise tested perl would link to old


More information about the scm-commits mailing list