Commit 7a7ec9b14a11a986cd91a4faab6af7f4367a3a16

Ran Benita 2012-03-31T02:30:33

Avoid leak in CompileKeymap error path The NULL check is unneeded, and prevented the atoms from being free'd. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb_map_unref.]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index 3518902..9f7dd2e 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -198,8 +198,7 @@ CompileKeymap(struct xkb_context *context, XkbFile *file, unsigned merge)
 
 err:
     ACTION("Failed to compile keymap\n");
-    if (xkb)
-        xkb_map_unref(xkb);
+    xkb_map_unref(xkb);
     while (unbound) {
         next = (LEDInfo *) unbound->defs.next;
         free(unbound);