summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/APItest.xs
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-30 23:31:40 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-10-01 00:04:10 -0700
commit1af585b377f459c152826f934bfb0dfa6ba48381 (patch)
tree7a936078056924960b07df80e870d8473118998b /ext/XS-APItest/APItest.xs
parente6351b379e8a391f69d0abf3aa4ffc5a8b53090b (diff)
downloadperl-1af585b377f459c152826f934bfb0dfa6ba48381.tar.gz
APItest.xs: Fix mem leak in lexsub test
Though this is harmless, since the test script is short-lived, it is good to fix it in case this test is copied by module authors.
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r--ext/XS-APItest/APItest.xs3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 8c045bcf45..1d2f6f3fdf 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -3445,7 +3445,8 @@ lexical_import(SV *name, CV *cv)
SAVESPTR(PL_comppad_name); PL_comppad_name = PadlistNAMES(pl);
SAVESPTR(PL_comppad); PL_comppad = PadlistARRAY(pl)[1];
SAVESPTR(PL_curpad); PL_curpad = PadARRAY(PL_comppad);
- off = pad_add_name_sv(newSVpvf("&%"SVf,name), padadd_STATE, 0, 0);
+ off = pad_add_name_sv(sv_2mortal(newSVpvf("&%"SVf,name)),
+ padadd_STATE, 0, 0);
SvREFCNT_dec(PL_curpad[off]);
PL_curpad[off] = SvREFCNT_inc(cv);
LEAVE;