From 0464a9910da2b99abea0ab202e179d66260a893b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 29 Mar 2018 15:19:42 -0400 Subject: [PATCH] Clean up status line on exit --- swaybar/bar.c | 5 +++++ swaybar/status_line.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/swaybar/bar.c b/swaybar/bar.c index 72c4be8f5..44f4ee31c 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -191,4 +191,9 @@ void bar_teardown(struct swaybar *bar) { if (bar->config) { free_config(bar->config); } + close(bar->ipc_event_socketfd); + close(bar->ipc_socketfd); + if (bar->status) { + status_line_free(bar->status); + } } diff --git a/swaybar/status_line.c b/swaybar/status_line.c index ff668c9c4..5b131aee5 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -73,6 +73,8 @@ struct status_line *status_line_init(char *cmd) { return status; } -void status_line_free(struct status_line *line) { - free(line); +void status_line_free(struct status_line *status) { + close(status->read_fd); + close(status->write_fd); + free(status); }