Various static analyzer fixes Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
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;
}