Change 27824 by [EMAIL PROTECTED] on 2006/04/15 21:11:44

        Coverity notes that resource are leaked in the unfinished and never
        called function _utf8_to_bytes.

Affected files ...

... //depot/perl/ext/Encode/Encode.xs#117 edit

Differences ...

==== //depot/perl/ext/Encode/Encode.xs#117 (text) ====
Index: perl/ext/Encode/Encode.xs
--- perl/ext/Encode/Encode.xs#116~26922~        2006-01-23 04:33:02.000000000 
-0800
+++ perl/ext/Encode/Encode.xs   2006-04-15 14:11:44.000000000 -0700
@@ -696,10 +696,12 @@
            /* 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 @@
                  *dest++ = (U8)uv;
                }
            }
+           RETVAL = dest - d0;
+           sv_usepvn(sv, (char *)dest, RETVAL);
+           SvUTF8_off(sv);
        } else {
            RETVAL = (utf8_to_bytes(s, &len) ? len : 0);
        }
End of Patch.

Reply via email to