diff options
| author | Nihal Jere <nihal@nihaljere.xyz> | 2022-02-25 11:40:04 -0600 |
|---|---|---|
| committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-02-28 11:24:13 -0500 |
| commit | 061ffc30ea899c3ed77004065d3958f19e3bb884 (patch) | |
| tree | 5e1874ef52852964732b2552671d0171623b1543 /swaynag/main.c | |
| parent | 0ee54a524329ab8d3db7dbe8286dc97b0bf57bed (diff) | |
swaynag: die on all allocation failures
Diffstat (limited to 'swaynag/main.c')
| -rw-r--r-- | swaynag/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |
