aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorlbonn <bonnans.l@gmail.com>2019-10-19 16:05:42 +0200
committerDrew DeVault <sir@cmpwn.com>2019-11-01 12:18:09 -0400
commit30fa7d191e031797c182fcec93f20ae9124ea664 (patch)
tree87ffd214d91f223583b762e0627f1016dfcbf910 /sway
parenta6307aed0089a35b5594f910c9604262b46832e6 (diff)
Fix potential NULL reference on cleanup
If allocation of bindings failed. Found with clang-tidy
Diffstat (limited to 'sway')
-rw-r--r--sway/config/bar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 9c30204e..f90fcdc0 100644
--- 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);