mirror of
https://github.com/swaywm/sway.git
synced 2025-11-04 13:29:52 -05:00
Handle allocation failure in commands
This commit is contained in:
parent
8691ff1b63
commit
248df18c24
11 changed files with 78 additions and 16 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue