Coverity: Uninit: CID 400
authorNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 17:58:57 +0000 (12:58 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Wed, 18 Jan 2012 17:58:57 +0000 (12:58 -0500)
* src/emacs.c (decode_path): make sure to return Qnil if
transcoding failed.

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

index b4fd41f..3ac6f2e 100644 (file)
@@ -3046,8 +3046,8 @@ split_string_by_emchar_1(const Bufbyte * string, Bytecount size, Emchar sepchar)
    (':' or whatever).  */
 Lisp_Object decode_path(/*const*/ char *path)
 {
-       Bytecount newlen;
-       Bufbyte *newpath;
+       Bytecount newlen = 0;
+       Bufbyte *newpath = NULL;
        if (!path)
                return Qnil;
 
@@ -3058,7 +3058,7 @@ Lisp_Object decode_path(/*const*/ char *path)
           decode_env_path(), but it looks dubious here.  Does any code
           depend on decode_path("") returning nil instead of an empty
           string?  */
-       if (!newlen)
+       if (!newlen || !newpath)
                return Qnil;
 
        return split_string_by_emchar_1(newpath, newlen, SEPCHAR);