}
free(map->types);
- for (key = xkb->min_key_code; key < xkb->max_key_code; key++) {
- free(map->key_sym_map[key].sym_index);
- free(map->key_sym_map[key].num_syms);
- free(map->key_sym_map[key].syms);
+ if (map->key_sym_map) {
+ for (key = xkb->min_key_code; key < xkb->max_key_code; key++) {
+ free(map->key_sym_map[key].sym_index);
+ free(map->key_sym_map[key].num_syms);
+ free(map->key_sym_map[key].syms);
+ }
}
free(map->key_sym_map);
unsigned required, legal;
unsigned mainType;
const char *mainName;
- LEDInfo *unbound = NULL;
+ LEDInfo *unbound = NULL, *next;
struct xkb_desc *xkb = XkbcAllocKeyboard(context);
struct {
XkbFile *keycodes;
}
/* compile the sections we have in the file one-by-one, or fail. */
- if (sections.keycodes != NULL &&
+ if (sections.keycodes == NULL ||
!CompileKeycodes(sections.keycodes, xkb, MergeOverride))
{
ERROR("Failed to compile keycodes\n");
goto err;
}
- if (sections.types != NULL &&
+ if (sections.types == NULL ||
!CompileKeyTypes(sections.types, xkb, MergeOverride))
{
ERROR("Failed to compile key types\n");
goto err;
}
- if (sections.compat != NULL &&
+ if (sections.compat == NULL ||
!CompileCompatMap(sections.compat, xkb, MergeOverride, &unbound))
{
ERROR("Failed to compile compat map\n");
goto err;
}
- if (sections.symbols != NULL &&
+ if (sections.symbols == NULL ||
!CompileSymbols(sections.symbols, xkb, MergeOverride))
{
ERROR("Failed to compile symbols\n");
ACTION("Failed to compile keymap\n");
if (xkb)
xkb_map_unref(xkb);
+ while (unbound) {
+ next = (LEDInfo *) unbound->defs.next;
+ free(unbound);
+ unbound = next;
+ }
return NULL;
}