You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
From 65ec73b1bc79648a2daeb494552ce0b0b90348d7 Mon Sep 17 00:00:00 2001
|
|
From: Tony Cook <tony@develop-help.com>
|
|
Date: Mon, 10 Aug 2020 16:26:30 +1000
|
|
Subject: [PATCH 1/3] Data::Dumper: don't leak the working retval
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
do this by mortalizing the SV on creation, rather than when we
|
|
push it on the stack
|
|
|
|
Petr Písař: Ported to Data-Dumper-2.173 from
|
|
41463160be4baa0d81d9d8297508a1b9bdcaa206 perl commit.
|
|
|
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
---
|
|
Dumper.xs | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/Dumper.xs b/Dumper.xs
|
|
index a324cb6..f91145a 100644
|
|
--- a/Dumper.xs
|
|
+++ b/Dumper.xs
|
|
@@ -1541,7 +1541,7 @@ Data_Dumper_Dumpxs(href, ...)
|
|
seenhv = NULL;
|
|
name = sv_newmortal();
|
|
|
|
- retval = newSVpvs("");
|
|
+ retval = newSVpvs_flags("", SVs_TEMP);
|
|
if (SvROK(href)
|
|
&& (hv = (HV*)SvRV((SV*)href))
|
|
&& SvTYPE(hv) == SVt_PVHV) {
|
|
@@ -1714,9 +1714,9 @@ Data_Dumper_Dumpxs(href, ...)
|
|
}
|
|
SvPVCLEAR(valstr);
|
|
if (gimme == G_ARRAY) {
|
|
- XPUSHs(sv_2mortal(retval));
|
|
+ XPUSHs(retval);
|
|
if (i < imax) /* not the last time thro ? */
|
|
- retval = newSVpvs("");
|
|
+ retval = newSVpvs_flags("", SVs_TEMP);
|
|
}
|
|
}
|
|
SvREFCNT_dec(postav);
|
|
@@ -1732,7 +1732,7 @@ Data_Dumper_Dumpxs(href, ...)
|
|
else
|
|
croak("Call to new() method failed to return HASH ref");
|
|
if (gimme != G_ARRAY)
|
|
- XPUSHs(sv_2mortal(retval));
|
|
+ XPUSHs(retval);
|
|
}
|
|
|
|
SV *
|
|
--
|
|
2.25.4
|
|
|