summaryrefslogtreecommitdiff
path: root/sway/commands/workspace.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/workspace.c
parent6c0fc2093641868df28c4087902a040f7fae05d4 (diff)
parentd859f825d3612492678f5cd6cc6dc1f2647929e1 (diff)
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r--sway/commands/workspace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index 35224f8a..14fe242f 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -61,6 +61,10 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
return error;
}
struct workspace_output *wso = calloc(1, sizeof(struct workspace_output));
+ if (!wso) {
+ return cmd_results_new(CMD_FAILURE, "workspace output",
+ "Unable to allocate workspace output");
+ }
wso->workspace = strdup(argv[0]);
wso->output = strdup(argv[2]);
int i = -1;