aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2023-01-02 11:05:55 +0100
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2023-01-02 11:36:37 +0100
commitdfb38509898881af408c80d97904a2736d495931 (patch)
treeb4307707b2ff743f48cba870d2d5b680fcbb2aa2
parent90d7b9769c07d65b1d9a49bca42a5d6e3a7ac5cf (diff)
downloadi3-dfb38509898881af408c80d97904a2736d495931.tar.gz
i3-dfb38509898881af408c80d97904a2736d495931.zip
fix reload binding memory issue: copy current_binding_mode
-rw-r--r--src/bindings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bindings.c b/src/bindings.c
index 4cb916fa..2c8d5970 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -845,7 +845,7 @@ CommandResult *run_binding(Binding *bind, Con *con) {
Binding *bind_cp = binding_copy(bind);
/* The "mode" command might change the current mode, so back it up to
* correctly produce an event later. */
- const char *modename = current_binding_mode;
+ char *modename = sstrdup(current_binding_mode);
CommandResult *result = parse_command(command, NULL, NULL);
free(command);
@@ -873,6 +873,7 @@ CommandResult *run_binding(Binding *bind, Con *con) {
}
ipc_send_binding_event("run", bind_cp, modename);
+ FREE(modename);
binding_free(bind_cp);
return result;