diff options
author | Drew DeVault <[email protected]> | 2016-12-15 17:39:09 -0500 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2016-12-15 19:01:40 -0500 |
commit | 248df18c24d2a849de984b477ca3913ce7c72441 (patch) | |
tree | 35beb85ecfcc54574d3b5e82c8445eb8c1219689 /sway/commands/assign.c | |
parent | 8691ff1b63655c6fb11fd2ffe90770e7de707963 (diff) |
Handle allocation failure in commands
Diffstat (limited to 'sway/commands/assign.c')
-rw-r--r-- | sway/commands/assign.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/commands/assign.c b/sway/commands/assign.c index 53c599ca..1824692b 100644 --- a/sway/commands/assign.c +++ b/sway/commands/assign.c @@ -27,6 +27,9 @@ struct cmd_results *cmd_assign(int argc, char **argv) { snprintf(cmdlist, arglen, "%s%s", movecmd, *argv); struct criteria *crit = malloc(sizeof(struct criteria)); + if (!crit) { + return cmd_results_new(CMD_FAILURE, "assign", "Unable to allocate criteria"); + } crit->crit_raw = strdup(criteria); crit->cmdlist = cmdlist; crit->tokens = create_list(); |