rules: simplify an error path
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 12 Nov 2019 05:25:16 +0000 (15:25 +1000)
committerRan Benita <ran234@gmail.com>
Tue, 24 Dec 2019 07:50:03 +0000 (09:50 +0200)
Initialize to NULL so we don't have to care about whether the cleanups can be
called or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/xkbcomp/rules.c

index 30c2f45..ba40d91 100644 (file)
@@ -1034,8 +1034,8 @@ xkb_components_from_rules(struct xkb_context *ctx,
 {
     bool ret = false;
     FILE *file;
-    char *path;
-    struct matcher *matcher;
+    char *path = NULL;
+    struct matcher *matcher = NULL;
 
     file = FindFileInXkbPath(ctx, rmlvo->rules, FILE_TYPE_RULES, &path);
     if (!file)
@@ -1050,8 +1050,8 @@ xkb_components_from_rules(struct xkb_context *ctx,
     if (!ret)
         log_err(ctx, "No components returned from XKB rules \"%s\"\n", path);
 
+err_out:
     matcher_free(matcher);
     free(path);
-err_out:
     return ret;
 }