diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-02-24 08:58:04 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-02-24 08:58:04 +0000 |
| commit | 3d9aa1c29cae7a493cb87055e6dfee92f0ff88c5 (patch) | |
| tree | 41d82328188e614103f9c5501b7b8f28edf2003d | |
| parent | ci: remove deprecated 'group' (diff) | |
config: don't try to free key combos we haven't allocated
When erroring out due to a key combo being "empty", we incorrectly
tried to free one key binding. This is because 'used_combos' is
initialized to '1'. And it should, but an empty key binding is a
special case.
Fixes a test failure, and closes #1620
| -rw-r--r-- | config.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1823,8 +1823,10 @@ value_to_key_combos(struct context *ctx, int action, return true; err: - for (size_t i = 0; i < used_combos; i++) - free_key_binding(&new_combos[i]); + if (idx > 0) { + for (size_t i = 0; i < used_combos; i++) + free_key_binding(&new_combos[i]); + } free(copy); return false; } |
