sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 30fa7d191e031797c182fcec93f20ae9124ea664
parent a6307aed0089a35b5594f910c9604262b46832e6
Author: lbonn <bonnans.l@gmail.com>
Date:   Sat, 19 Oct 2019 16:05:42 +0200

Fix potential NULL reference on cleanup

If allocation of bindings failed.

Found with clang-tidy

Diffstat:
Msway/config/bar.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sway/config/bar.c b/sway/config/bar.c @@ -39,8 +39,10 @@ void free_bar_config(struct bar_config *bar) { free(bar->swaybar_command); free(bar->font); free(bar->separator_symbol); - for (int i = 0; i < bar->bindings->length; i++) { - free_bar_binding(bar->bindings->items[i]); + if (bar->bindings) { + for (int i = 0; i < bar->bindings->length; i++) { + free_bar_binding(bar->bindings->items[i]); + } } list_free(bar->bindings); list_free_items_and_destroy(bar->outputs);