Fix potential NULL reference on cleanup

If allocation of bindings failed.

Found with clang-tidy
This commit is contained in:
lbonn 2019-10-19 16:05:42 +02:00 committed by Drew DeVault
parent a6307aed00
commit 30fa7d191e

View file

@ -39,9 +39,11 @@ void free_bar_config(struct bar_config *bar) {
free(bar->swaybar_command); free(bar->swaybar_command);
free(bar->font); free(bar->font);
free(bar->separator_symbol); free(bar->separator_symbol);
if (bar->bindings) {
for (int i = 0; i < bar->bindings->length; i++) { for (int i = 0; i < bar->bindings->length; i++) {
free_bar_binding(bar->bindings->items[i]); free_bar_binding(bar->bindings->items[i]);
} }
}
list_free(bar->bindings); list_free(bar->bindings);
list_free_items_and_destroy(bar->outputs); list_free_items_and_destroy(bar->outputs);
if (bar->client != NULL) { if (bar->client != NULL) {