summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorgfx <gfuji@cpan.org>2010-05-05 06:54:11 -0400
committerJesse Vincent <jesse@bestpractical.com>2010-06-28 22:30:06 -0400
commite3a22e3fde4a0485bb3fee606a63025eb3214eb9 (patch)
tree401923ce6d44b191deb4e89a7bc4c8cd79ad9079 /universal.c
parentd808b6810e2e80e71657bdc95f0a5a577b30e300 (diff)
downloadperl-e3a22e3fde4a0485bb3fee606a63025eb3214eb9.tar.gz
Stop leaking temporary version objects from XS
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/universal.c b/universal.c
index 2f73dd06cb..07a0aa66f5 100644
--- a/universal.c
+++ b/universal.c
@@ -392,20 +392,20 @@ XS(XS_UNIVERSAL_VERSION)
if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) {
Perl_croak(aTHX_ "%s version %"SVf" required--"
"this is only version %"SVf"", HvNAME_get(pkg),
- SVfARG(vnormal(req)),
- SVfARG(vnormal(sv)));
+ SVfARG(sv_2mortal(vnormal(req))),
+ SVfARG(sv_2mortal(vnormal(sv))));
} else {
Perl_croak(aTHX_ "%s version %"SVf" required--"
"this is only version %"SVf"", HvNAME_get(pkg),
- SVfARG(vstringify(req)),
- SVfARG(vstringify(sv)));
+ SVfARG(sv_2mortal(vstringify(req))),
+ SVfARG(sv_2mortal(vstringify(sv))));
}
}
}
if ( SvOK(sv) && sv_derived_from(sv, "version") ) {
- ST(0) = vstringify(sv);
+ ST(0) = sv_2mortal(vstringify(sv));
} else {
ST(0) = sv;
}
@@ -541,7 +541,8 @@ XS(XS_version_vcmp)
if ( ! sv_derived_from(robj, "version") )
{
- robj = new_version(SvOK(robj) ? robj : newSVpvs("0"));
+ robj = new_version(SvOK(robj) ? robj : newSVpvs_flags("0", SVs_TEMP));
+ sv_2mortal(robj);
}
rvs = SvRV(robj);