diff options
Diffstat (limited to 'sway/commands/mode.c')
-rw-r--r-- | sway/commands/mode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/commands/mode.c b/sway/commands/mode.c index f9cb271e..ed3f432f 100644 --- a/sway/commands/mode.c +++ b/sway/commands/mode.c | |||
@@ -30,7 +30,10 @@ struct cmd_results *cmd_mode(int argc, char **argv) { | |||
30 | } | 30 | } |
31 | // Create mode if it doesn't exist | 31 | // Create mode if it doesn't exist |
32 | if (!mode && mode_make) { | 32 | if (!mode && mode_make) { |
33 | mode = malloc(sizeof*mode); | 33 | mode = malloc(sizeof(struct sway_mode)); |
34 | if (!mode) { | ||
35 | return cmd_results_new(CMD_FAILURE, "mode", "Unable to allocate mode"); | ||
36 | } | ||
34 | mode->name = strdup(mode_name); | 37 | mode->name = strdup(mode_name); |
35 | mode->bindings = create_list(); | 38 | mode->bindings = create_list(); |
36 | list_add(config->modes, mode); | 39 | list_add(config->modes, mode); |