aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/bar
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bar')
-rw-r--r--sway/commands/bar/bindsym.c3
-rw-r--r--sway/commands/bar/colors.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/sway/commands/bar/bindsym.c b/sway/commands/bar/bindsym.c
index bb81b4a9..5f90b51a 100644
--- a/sway/commands/bar/bindsym.c
+++ b/sway/commands/bar/bindsym.c
@@ -26,6 +26,9 @@ struct cmd_results *bar_cmd_bindsym(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "bindsym", "Invalid mouse binding %s", argv[1]);
}
struct sway_mouse_binding *binding = malloc(sizeof(struct sway_mouse_binding));
+ if (!binding) {
+ return cmd_results_new(CMD_FAILURE, "bindsym", "Unable to allocate binding");
+ }
binding->button = numbutton;
binding->command = join_args(argv + 1, argc - 1);
diff --git a/sway/commands/bar/colors.c b/sway/commands/bar/colors.c
index f6fb520a..8b3b0aac 100644
--- a/sway/commands/bar/colors.c
+++ b/sway/commands/bar/colors.c
@@ -9,6 +9,9 @@ static struct cmd_results *parse_single_color(char **color, const char *cmd_name
if (!*color) {
*color = malloc(10);
+ if (!*color) {
+ return cmd_results_new(CMD_FAILURE, cmd_name, "Unable to allocate color");
+ }
}
error = add_color(cmd_name, *color, argv[0]);
@@ -29,6 +32,9 @@ static struct cmd_results *parse_three_colors(char ***colors, const char *cmd_na
for (i = 0; i < 3; i++) {
if (!*colors[i]) {
*(colors[i]) = malloc(10);
+ if (!*(colors[i])) {
+ return cmd_results_new(CMD_FAILURE, cmd_name, "Unable to allocate color");
+ }
}
error = add_color(cmd_name, *(colors[i]), argv[i]);
if (error) {