summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-03-07 22:52:31 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-03-07 22:52:31 +0000
commit5d97567dd5d99fd909fe6858c74f7b2ca0ad9772 (patch)
tree0e50d8e9495551f739cb170be34d8a663d110f95
parent6b870b8454d6444831a0115cfbb46cf20103f15b (diff)
downloadperl-maint-5.8.tar.gz
Revert "Fix memory leak in Encode.xs"maint-5.8
Because it breaks Win32 This reverts commit 6b870b8454d6444831a0115cfbb46cf20103f15b.
-rw-r--r--ext/Encode/Encode.xs8
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);
}