In perl.git, the branch maint-5.12 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/82ba7a81cfdc43426b7faaa9ad82dc1f8cf5f247?hp=ae271f001f6290a5e494d846ab5a78f5abe79752>
- Log ----------------------------------------------------------------- commit 82ba7a81cfdc43426b7faaa9ad82dc1f8cf5f247 Author: Chris 'BinGOs' Williams <[email protected]> Date: Wed Mar 6 16:55:19 2013 +0000 Fix memory leak in Encode.xs ----------------------------------------------------------------------- Summary of changes: cpan/Encode/Encode.xs | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs index b2e9127..c44d8f3 100644 --- a/cpan/Encode/Encode.xs +++ b/cpan/Encode/Encode.xs @@ -435,7 +435,6 @@ CODE: if (src == &PL_sv_undef) src = newSV(0); s = (U8 *) SvPV(src, slen); e = (U8 *) SvEND(src); - dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */ check = SvROK(check_sv) ? ENCODE_PERLQQ|ENCODE_LEAVE_SRC : SvIV(check_sv); /* * PerlIO check -- we assume the object is of PerlIO if renewed @@ -466,6 +465,7 @@ CODE: } } + dst = sv_2mortal(newSV(slen>0?slen:1)); /* newSV() abhors 0 -- inaba */ s = process_utf8(aTHX_ dst, s, e, check_sv, 0, strict_utf8(aTHX_ obj), renewed); /* Clear out translated part of source unless asked not to */ @@ -477,7 +477,7 @@ CODE: SvCUR_set(src, slen); } SvUTF8_on(dst); - ST(0) = sv_2mortal(dst); + ST(0) = dst; XSRETURN(1); } @@ -499,7 +499,7 @@ CODE: if (src == &PL_sv_undef) src = newSV(0); s = (U8 *) SvPV(src, slen); e = (U8 *) SvEND(src); - dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */ + dst = sv_2mortal(newSV(slen>0?slen:1)); /* newSV() abhors 0 -- inaba */ if (SvUTF8(src)) { /* Already encoded */ if (strict_utf8(aTHX_ obj)) { @@ -538,7 +538,7 @@ CODE: } SvPOK_only(dst); SvUTF8_off(dst); - ST(0) = sv_2mortal(dst); + ST(0) = dst; XSRETURN(1); } -- Perl5 Master Repository
