From 6e9bbe67ce5f02ff6ac24889e5a215ee46247c32 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 27 Jun 2012 17:48:22 +0200 Subject: [PATCH] Bugfix: fix reload crashes in rare cases (Thanks Tucos) Depending on the memory layout, it could happen that bind->command was exchanged with something else while the parser still accessed it. Therefore, we now copy the command and let the parser use that copy. --- src/handlers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/handlers.c b/src/handlers.c index 148d6337..cb76eb78 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -119,7 +119,9 @@ static void handle_key_press(xcb_key_press_event_t *event) { } } - struct CommandResult *command_output = parse_command(bind->command); + char *command_copy = sstrdup(bind->command); + struct CommandResult *command_output = parse_command(command_copy); + free(command_copy); if (command_output->needs_tree_render) tree_render(); -- 2.39.5