xkbcomp: Fail when converting rules to components returns an error XkbcRF_GetComponents was returning an error but leaving the generated components alone. This ensures that the broken XkbComponentNamesPtr is freed and the error is passed up to the caller.
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 790f1ae..bab4403 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -86,8 +86,17 @@ XkbComponentsFromRules(const char *rulesPath, const XkbRF_VarDefsPtr defs)
goto unwind_rules;
}
- if (!XkbcRF_GetComponents(rules, defs, names))
+ if (!XkbcRF_GetComponents(rules, defs, names)) {
+ _XkbFree(names->keymap);
+ _XkbFree(names->keycodes);
+ _XkbFree(names->types);
+ _XkbFree(names->compat);
+ _XkbFree(names->symbols);
+ _XkbFree(names->geometry);
+ _XkbFree(names);
+ names = NULL;
ERROR("no components returned from XKB rules \"%s\"\n", rulesPath);
+ }
unwind_rules:
XkbcRF_Free(rules, True);