summaryrefslogtreecommitdiff
path: root/sway/commands/bar/bindsym.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-12-17 13:23:44 -0500
committerGitHub <[email protected]>2016-12-17 13:23:44 -0500
commitf04ee0e68d885d7e1101cc88f9a9337202041f1f (patch)
treefa4dc296a5f1377867752d320ceef4e4b0178bbf /sway/commands/bar/bindsym.c
parent6c0fc2093641868df28c4087902a040f7fae05d4 (diff)
parentd859f825d3612492678f5cd6cc6dc1f2647929e1 (diff)
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
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);