config: fix memory leak on e.g. "not a valid XKB key name" errors

This commit is contained in:
Daniel Eklöf 2025-01-27 06:34:20 +01:00
parent 846271e8d3
commit 43206e6601
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1928,7 +1928,8 @@ value_to_key_combos(struct context *ctx, int action,
if (idx == 0) { if (idx == 0) {
LOG_CONTEXTUAL_ERR( LOG_CONTEXTUAL_ERR(
"empty binding not allowed (set to 'none' to unmap)"); "empty binding not allowed (set to 'none' to unmap)");
goto err; free(copy);
return false;
} }
remove_from_key_bindings_list(bindings, action, aux); remove_from_key_bindings_list(bindings, action, aux);
@ -1946,10 +1947,8 @@ value_to_key_combos(struct context *ctx, int action,
return true; return true;
err: err:
if (idx > 0) { for (size_t i = 0; i < used_combos; i++)
for (size_t i = 0; i < used_combos; i++) free_key_binding(&new_combos[i]);
free_key_binding(&new_combos[i]);
}
free(copy); free(copy);
return false; return false;
} }