Coverity: UNINIT: CID 393
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 18:11:14 +0000 (13:11 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 18:11:14 +0000 (13:11 -0500)
* src/print.c (write_string_to_stdio_stream): handle the case
where the transcoding fails.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/print.c

index ac733f2..5ce5549 100644 (file)
@@ -325,7 +325,7 @@ write_string_to_stdio_stream(FILE * stream, struct console *con,
                             Lisp_Object coding_system, int must_flush)
 {
        Extcount extlen;
-       const Extbyte *extptr;
+       const Extbyte *extptr = NULL;
 
        /* #### yuck! sometimes this function is called with string data,
           and the following call may gc. */
@@ -333,11 +333,12 @@ write_string_to_stdio_stream(FILE * stream, struct console *con,
                Bufbyte *puta = (Bufbyte *) alloca(len);
                memcpy(puta, str + offset, len);
 
-               if (initialized && !inhibit_non_essential_printing_operations)
+               if (initialized && !inhibit_non_essential_printing_operations) {
                        TO_EXTERNAL_FORMAT(DATA, (puta, len),
                                           ALLOCA, (extptr, extlen),
                                           coding_system);
-               else {
+               }
+               if( extptr == NULL ) {
                        extptr = (Extbyte *) puta;
                        extlen = (Bytecount) len;
                }