From 5b62b79a2af22f765fd6e7933f1034e9506ef9e7 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Fri, 25 Feb 2022 11:40:04 -0600 Subject: swaynag: die on all allocation failures --- swaynag/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'swaynag/main.c') diff --git a/swaynag/main.c b/swaynag/main.c index 88007818..0c94cb1a 100644 --- a/swaynag/main.c +++ b/swaynag/main.c @@ -32,12 +32,20 @@ int main(int argc, char **argv) { struct swaynag_button *button_close = calloc(sizeof(struct swaynag_button), 1); + if (!button_close) { + perror("calloc"); + return EXIT_FAILURE; + } button_close->text = strdup("X"); button_close->type = SWAYNAG_ACTION_DISMISS; list_add(swaynag.buttons, button_close); swaynag.details.button_details = calloc(sizeof(struct swaynag_button), 1); + if (!swaynag.details.button_details) { + perror("calloc"); + return EXIT_FAILURE; + } swaynag.details.button_details->text = strdup("Toggle details"); swaynag.details.button_details->type = SWAYNAG_ACTION_EXPAND; -- cgit v1.2.3