diff options
author | Di Ma <focus64@gmail.com> | 2020-03-22 15:21:51 -0700 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-04-14 19:41:30 -0400 |
commit | a3e574f63ffdf34b1bc21620be3d065cee1ea54b (patch) | |
tree | 7b27eefd6aa716f627be327b94c8162804942672 /sway/input/switch.c | |
parent | Implement create_output command for headless backend (diff) | |
download | sway-a3e574f63ffdf34b1bc21620be3d065cee1ea54b.tar.gz sway-a3e574f63ffdf34b1bc21620be3d065cee1ea54b.tar.zst sway-a3e574f63ffdf34b1bc21620be3d065cee1ea54b.zip |
Fix a use-after-free error in switch binding
Diffstat (limited to 'sway/input/switch.c')
-rw-r--r-- | sway/input/switch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/input/switch.c b/sway/input/switch.c index b7c28df1..8347f066 100644 --- a/sway/input/switch.c +++ b/sway/input/switch.c | |||
@@ -1,8 +1,10 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
1 | #include "sway/config.h" | 2 | #include "sway/config.h" |
2 | #include "sway/desktop/transaction.h" | 3 | #include "sway/desktop/transaction.h" |
3 | #include "sway/input/switch.h" | 4 | #include "sway/input/switch.h" |
4 | #include <wlr/types/wlr_idle.h> | 5 | #include <wlr/types/wlr_idle.h> |
5 | #include "log.h" | 6 | #include "log.h" |
7 | #include <string.h> | ||
6 | 8 | ||
7 | struct sway_switch *sway_switch_create(struct sway_seat *seat, | 9 | struct sway_switch *sway_switch_create(struct sway_seat *seat, |
8 | struct sway_seat_device *device) { | 10 | struct sway_seat_device *device) { |
@@ -56,7 +58,7 @@ static void execute_binding(struct sway_switch *sway_switch) { | |||
56 | calloc(1, sizeof(struct sway_binding)); | 58 | calloc(1, sizeof(struct sway_binding)); |
57 | dummy_binding->type = BINDING_SWITCH; | 59 | dummy_binding->type = BINDING_SWITCH; |
58 | dummy_binding->flags = matched_binding->flags; | 60 | dummy_binding->flags = matched_binding->flags; |
59 | dummy_binding->command = matched_binding->command; | 61 | dummy_binding->command = strdup(matched_binding->command); |
60 | 62 | ||
61 | seat_execute_command(seat, dummy_binding); | 63 | seat_execute_command(seat, dummy_binding); |
62 | free(dummy_binding); | 64 | free(dummy_binding); |