Commit 75ff2cefdaf03008dcbe5d721315851eb46dfabc

Ran Benita 2012-05-13T18:45:43

Various static analyzer fixes Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/context.c b/src/context.c
index 3f2f13d..7112b47 100644
--- a/src/context.c
+++ b/src/context.c
@@ -95,7 +95,7 @@ xkb_context_include_path_append(struct xkb_context *ctx, const char *path)
 _X_EXPORT int
 xkb_context_include_path_append_default(struct xkb_context *ctx)
 {
-    const char *home = getenv("HOME");
+    const char *home;
     char *user_path;
     int err;
 
diff --git a/src/xkbcomp/alias.c b/src/xkbcomp/alias.c
index a6728db..2b05646 100644
--- a/src/xkbcomp/alias.c
+++ b/src/xkbcomp/alias.c
@@ -214,9 +214,8 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
         *info_in = NULL;
         return true;
     }
+
     status = XkbcAllocNames(keymap, XkbKeyAliasesMask, nOld + nNew);
-    if (keymap->names)
-        old = keymap->names->key_aliases;
     if (status != Success)
     {
         WSGO("Allocation failure in ApplyAliases\n");
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index a1f4c60..f3bf821 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -68,7 +68,7 @@ CompileKeymap(struct xkb_context *ctx, XkbFile *file)
         return false;
     }
     have = 0;
-    ok = 1;
+
     /* Check for duplicate entries in the input file */
     for (file = (XkbFile *) file->defs; file; file = (XkbFile *) file->common.next)
     {
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 7e8763c..8518a1d 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -199,7 +199,10 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
 
     /* Find map to use */
     mapToUse = XkbChooseMap(file, NULL);
-    if (!mapToUse || mapToUse->type != XkmKeymapFile) {
+    if (!mapToUse)
+        goto err;
+
+    if (mapToUse->type != XkmKeymapFile) {
         ERROR("file type %d not handled\n", mapToUse->type);
         goto err;
     }