aboutsummaryrefslogtreecommitdiff
path: root/swaybar/status_line.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-25 11:00:24 +0200
committerGitHub <noreply@github.com>2018-04-25 11:00:24 +0200
commit75674295504af9118d2af3c8677d8e1e84e85e77 (patch)
tree096f6c4635168e71e29e611cebc9afac9e22736b /swaybar/status_line.c
parent317b8cbd9374dafa0c8649e9db45cdee7b748fd2 (diff)
parentaa36899d8a54d359bf3da997fb6f681199e49938 (diff)
Merge pull request #1861 from emersion/swaybar-memory-leaks
Fix a bunch of swaybar memory leaks
Diffstat (limited to 'swaybar/status_line.c')
-rw-r--r--swaybar/status_line.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index 8d781ca3..e0e7414a 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -1,4 +1,4 @@
-#define _POSIX_C_SOURCE 199309L
+#define _POSIX_C_SOURCE 200809L
#include <fcntl.h>
#include <json-c/json.h>
#include <stdlib.h>
@@ -126,5 +126,17 @@ void status_line_free(struct status_line *status) {
close(status->read_fd);
close(status->write_fd);
kill(status->pid, SIGTERM);
+ switch (status->protocol) {
+ case PROTOCOL_I3BAR:;
+ struct i3bar_block *block, *tmp;
+ wl_list_for_each_safe(block, tmp, &status->blocks, link) {
+ i3bar_block_free(block);
+ }
+ free(status->i3bar_state.buffer);
+ break;
+ default:
+ free(status->text_state.buffer);
+ break;
+ }
free(status);
}