Coverity: UNINIT: CID 600
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 16:39:21 +0000 (11:39 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 16:39:21 +0000 (11:39 -0500)
* src/ui/X11/objects-x.c (x_find_charset_font): Make sure intname
is only used if transcoding worked properly.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/ui/X11/objects-x.c

index 6419630..f288b16 100644 (file)
@@ -928,13 +928,14 @@ x_find_charset_font(Lisp_Object device, Lisp_Object font, Lisp_Object charset)
                           patternext, MAX_FONT_COUNT, &count);
        /* #### This code seems awfully bogus -- mrb */
        for (i = 0; i < count; i++) {
-               const Bufbyte *intname;
+               const Bufbyte *intname = NULL;
                Bytecount intlen;
 
                TO_INTERNAL_FORMAT(C_STRING, names[i],
                                   ALLOCA, (intname, intlen),
                                   Qx_font_name_encoding);
-               if (x_font_spec_matches_charset(XDEVICE(device), charset,
+               if (intname != NULL &&
+                   x_font_spec_matches_charset(XDEVICE(device), charset,
                                                intname, Qnil, 0, -1)) {
                        result = make_string(intname, intlen);
                        break;