]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: fix reload crashes in rare cases (Thanks Tucos)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 27 Jun 2012 15:48:22 +0000 (17:48 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 27 Jun 2012 15:48:22 +0000 (17:48 +0200)
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

index 148d63370a8b5cc2e4b1a45e04ae6ea382b00292..cb76eb788d99b328f67a194bf4cc34ad72cf2ee7 100644 (file)
@@ -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();