diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-03-07 22:51:37 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-03-07 22:51:37 +0000 |
commit | e94431af0ada74486afd65207f3e0345fe7485fe (patch) | |
tree | 587a8d350aed0ad2dc5fe7ec10892a0f3d65d0a8 | |
parent | 27a6588a70ffa9e9000ca20f266a92f93cbf1a78 (diff) | |
download | perl-maint-5.10.tar.gz |
Revert "Fix memory leak in Encode.xs"maint-5.10
Because it breaks Win32
This reverts commit 27a6588a70ffa9e9000ca20f266a92f93cbf1a78.
-rw-r--r-- | ext/Encode/Encode.xs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 9f9dc9cd53..1424071f3a 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -410,6 +410,7 @@ CODE: STRLEN slen; U8 *s = (U8 *) SvPV(src, slen); U8 *e = (U8 *) SvEND(src); + SV *dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */ /* * PerlIO check -- we assume the object is of PerlIO if renewed @@ -442,7 +443,6 @@ CODE: } } - SV *dst = sv_2mortal(newSV(slen>0?slen:1)); s = process_utf8(aTHX_ dst, s, e, check, 0, strict_utf8(aTHX_ obj), renewed); /* Clear out translated part of source unless asked not to */ @@ -454,7 +454,7 @@ CODE: SvCUR_set(src, slen); } SvUTF8_on(dst); - ST(0) = dst; + ST(0) = sv_2mortal(dst); XSRETURN(1); } @@ -468,7 +468,7 @@ CODE: STRLEN slen; U8 *s = (U8 *) SvPV(src, slen); U8 *e = (U8 *) SvEND(src); - SV *dst = sv_2mortal(newSV(slen>0?slen:1)); + SV *dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */ if (SvUTF8(src)) { /* Already encoded */ if (strict_utf8(aTHX_ obj)) { @@ -507,7 +507,7 @@ CODE: } SvPOK_only(dst); SvUTF8_off(dst); - ST(0) = dst; + ST(0) = sv_2mortal(dst); XSRETURN(1); } |