Commit 1e6f956e36720f75b3208411cd4e3271d4fb982f

Ran Benita 2012-03-01T21:03:13

Free scanFile when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index c72af74..b4bac2b 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -196,7 +196,7 @@ struct xkb_desc *
 xkb_compile_keymap_from_components(const struct xkb_component_names * ktcsg)
 {
     XkbFile *file, *mapToUse;
-    struct xkb_desc * xkb;
+    struct xkb_desc * xkb = NULL;
 
     uSetErrorFile(NULL);
 
@@ -222,24 +222,22 @@ xkb_compile_keymap_from_components(const struct xkb_component_names * ktcsg)
 
     if (!CompileKeymap(mapToUse, xkb, MergeReplace)) {
         ERROR("failed to compile keymap\n");
-        goto unwind_xkb;
+        XkbcFreeKeyboard(xkb);
+        xkb = NULL;
     }
 
-    FreeXKBFile(file);
-    return xkb;
-unwind_xkb:
-    XkbcFreeKeyboard(xkb);
 unwind_file:
     FreeXKBFile(file);
+    free(scanFile);
 fail:
-    return NULL;
+    return xkb;
 }
 
 static struct xkb_desc *
 compile_keymap(XkbFile *file, const char *mapName)
 {
     XkbFile *mapToUse;
-    struct xkb_desc * xkb;
+    struct xkb_desc * xkb = NULL;
 
     /* Find map to use */
     if (!(mapToUse = XkbChooseMap(file, mapName)))
@@ -263,17 +261,14 @@ compile_keymap(XkbFile *file, const char *mapName)
 
     if (!CompileKeymap(mapToUse, xkb, MergeReplace)) {
         ERROR("failed to compile keymap\n");
-        goto unwind_xkb;
+        XkbcFreeKeyboard(xkb);
+        xkb = NULL;
     }
 
-    FreeXKBFile(file);
-    return xkb;
-unwind_xkb:
-    XkbcFreeKeyboard(xkb);
 unwind_file:
     FreeXKBFile(file);
-
-    return NULL;
+    free(scanFile);
+    return xkb;
 }
 
 struct xkb_desc *