summaryrefslogtreecommitdiff
path: root/ext/Encode
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-15 21:11:44 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-15 21:11:44 +0000
commit5860085a49b592c6a586022a93b99a5b2e2d24a5 (patch)
treef5666e8e35943462040667dd90a1c54846d7bd09 /ext/Encode
parent71cd1c3f4e2173121a6276de584bf61b847fd780 (diff)
downloadperl-5860085a49b592c6a586022a93b99a5b2e2d24a5.tar.gz
Coverity notes that resource are leaked in the unfinished and never
called function _utf8_to_bytes. p4raw-id: //depot/perl@27824
Diffstat (limited to 'ext/Encode')
-rw-r--r--ext/Encode/Encode.xs7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs
index b60ead425f..47087da743 100644
--- a/ext/Encode/Encode.xs
+++ b/ext/Encode/Encode.xs
@@ -696,10 +696,12 @@ CODE:
/* Must do things the slow way */
U8 *dest;
/* We need a copy to pass to check() */
- U8 *src = (U8*)savepv((char *)s);
+ U8 *src = s;
U8 *send = s + len;
+ U8 *d0;
New(83, dest, len, U8); /* I think */
+ d0 = dest;
while (s < send) {
if (*s < 0x80){
@@ -735,6 +737,9 @@ CODE:
*dest++ = (U8)uv;
}
}
+ RETVAL = dest - d0;
+ sv_usepvn(sv, (char *)dest, RETVAL);
+ SvUTF8_off(sv);
} else {
RETVAL = (utf8_to_bytes(s, &len) ? len : 0);
}