aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/assign.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/assign.c')
-rw-r--r--sway/commands/assign.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/commands/assign.c b/sway/commands/assign.c
index 1824692b..992b4692 100644
--- a/sway/commands/assign.c
+++ b/sway/commands/assign.c
@@ -23,11 +23,14 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
char *movecmd = "move container to workspace ";
int arglen = strlen(movecmd) + strlen(*argv) + 1;
char *cmdlist = calloc(1, arglen);
-
+ if (!cmdlist) {
+ return cmd_results_new(CMD_FAILURE, "assign", "Unable to allocate command list");
+ }
snprintf(cmdlist, arglen, "%s%s", movecmd, *argv);
struct criteria *crit = malloc(sizeof(struct criteria));
if (!crit) {
+ free(cmdlist);
return cmd_results_new(CMD_FAILURE, "assign", "Unable to allocate criteria");
}
crit->crit_raw = strdup(criteria);