From 43206e66016175407abd11c415c7135c293a0c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 27 Jan 2025 06:34:20 +0100 Subject: [PATCH] config: fix memory leak on e.g. "not a valid XKB key name" errors --- config.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/config.c b/config.c index a0d32869..12336e3d 100644 --- a/config.c +++ b/config.c @@ -1928,7 +1928,8 @@ value_to_key_combos(struct context *ctx, int action, if (idx == 0) { LOG_CONTEXTUAL_ERR( "empty binding not allowed (set to 'none' to unmap)"); - goto err; + free(copy); + return false; } remove_from_key_bindings_list(bindings, action, aux); @@ -1946,10 +1947,8 @@ value_to_key_combos(struct context *ctx, int action, return true; err: - if (idx > 0) { - for (size_t i = 0; i < used_combos; i++) - free_key_binding(&new_combos[i]); - } + for (size_t i = 0; i < used_combos; i++) + free_key_binding(&new_combos[i]); free(copy); return false; }