summaryrefslogtreecommitdiff
path: root/sway/commands/bar/bindsym.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-12-15 17:39:09 -0500
committerDrew DeVault <[email protected]>2016-12-15 19:01:40 -0500
commit248df18c24d2a849de984b477ca3913ce7c72441 (patch)
tree35beb85ecfcc54574d3b5e82c8445eb8c1219689 /sway/commands/bar/bindsym.c
parent8691ff1b63655c6fb11fd2ffe90770e7de707963 (diff)
Handle allocation failure in commands
Diffstat (limited to 'sway/commands/bar/bindsym.c')
-rw-r--r--sway/commands/bar/bindsym.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/commands/bar/bindsym.c b/sway/commands/bar/bindsym.c
index bb81b4a9..5f90b51a 100644
--- a/sway/commands/bar/bindsym.c
+++ b/sway/commands/bar/bindsym.c
@@ -26,6 +26,9 @@ struct cmd_results *bar_cmd_bindsym(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "bindsym", "Invalid mouse binding %s", argv[1]);
}
struct sway_mouse_binding *binding = malloc(sizeof(struct sway_mouse_binding));
+ if (!binding) {
+ return cmd_results_new(CMD_FAILURE, "bindsym", "Unable to allocate binding");
+ }
binding->button = numbutton;
binding->command = join_args(argv + 1, argc - 1);