diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-12-17 13:23:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-17 13:23:44 -0500 |
commit | f04ee0e68d885d7e1101cc88f9a9337202041f1f (patch) | |
tree | fa4dc296a5f1377867752d320ceef4e4b0178bbf /sway/commands/set.c | |
parent | 6c0fc2093641868df28c4087902a040f7fae05d4 (diff) | |
parent | d859f825d3612492678f5cd6cc6dc1f2647929e1 (diff) | |
download | sway-f04ee0e68d885d7e1101cc88f9a9337202041f1f.tar.xz |
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
Diffstat (limited to 'sway/commands/set.c')
-rw-r--r-- | sway/commands/set.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/commands/set.c b/sway/commands/set.c index 1f324951..8b293825 100644 --- a/sway/commands/set.c +++ b/sway/commands/set.c @@ -47,6 +47,9 @@ struct cmd_results *cmd_set(int argc, char **argv) { free(var->value); } else { var = malloc(sizeof(struct sway_variable)); + if (!var) { + return cmd_results_new(CMD_FAILURE, "set", "Unable to allocate variable"); + } var->name = strdup(argv[0]); list_add(config->symbols, var); list_qsort(config->symbols, compare_set_qsort); |