summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJirka Hruška <jirka@fud.cz>2010-09-01 10:59:35 +0100
committerDavid Mitchell <davem@iabyn.com>2010-09-01 12:24:44 +0100
commit61e14cb44198449802cc50bc000890b1db9ba3f2 (patch)
treeeca0bd13b51150de14acff68eca3865a6a8d0893
parent7b1903740d907382fa6f406bd7ab1262921746c8 (diff)
downloadperl-61e14cb44198449802cc50bc000890b1db9ba3f2.tar.gz
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
-rw-r--r--AUTHORS1
-rw-r--r--sv.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index e7e3fb2227..20f57a6b03 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -493,6 +493,7 @@ Jim Meyering <meyering@asic.sc.ti.com>
Jim Miner <jfm@winternet.com>
Jim Richardson
Jim Schneider <jschneid@netilla.com>
+Jirka Hruška <jirka@fud.cz>
Joachim Huober
Jochen Wiedmann <joe@ispsoft.de>
Jody Belka <dev-perl@pimb.org>
diff --git a/sv.c b/sv.c
index 9b0180f862..5c464609a4 100644
--- a/sv.c
+++ b/sv.c
@@ -11412,6 +11412,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const 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
@@ -11425,8 +11426,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
Perl_sv_add_backref(aTHX_ MUTABLE_SV(GvSTASH(dstr)), dstr);
GvGP(dstr) = gp_dup(GvGP(sstr), param);
(void)GpREFCNT_inc(GvGP(dstr));
- } else
- Perl_rvpv_dup(aTHX_ dstr, sstr, param);
+ }
break;
case SVt_PVIO:
/* PL_parser->rsfp_filters entries have fake IoDIRP() */