From cd3da457993015146a077b75e7d23ef94a91c256 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 10 Jul 2017 19:00:12 -0400 Subject: [PATCH] Merge pull request #1270 from tobiasblass/bindsym_use_after_free fix use-after-free bug --- sway/commands/bind.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sway/commands/bind.c b/sway/commands/bind.c index af5a01e52..d9ea37b71 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -61,10 +61,11 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) { sym = ((char *)split->items[i])[strlen("button")] - '1' + M_LEFT_CLICK; } if (!sym) { + struct cmd_results *ret = cmd_results_new(CMD_INVALID, "bindsym", + "Unknown key '%s'", (char *)split->items[i]); free_sway_binding(binding); free_flat_list(split); - return cmd_results_new(CMD_INVALID, "bindsym", "Unknown key '%s'", - (char *)split->items[i]); + return ret; } xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t)); if (!key) {