aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-02-11 03:26:12 -0500
committerDrew DeVault <sir@cmpwn.com>2019-02-11 10:22:53 -0500
commita5a189cc73941c41f7486ba6bb561ca80dcea601 (patch)
treee1de3ad589e623ec08b7391a2172ee97a50b4263
parenta4d7ee1923e5847829367d741bea8c954034c312 (diff)
downloadsway-a5a189cc73941c41f7486ba6bb561ca80dcea601.zip
sway-a5a189cc73941c41f7486ba6bb561ca80dcea601.tar.gz
sway-a5a189cc73941c41f7486ba6bb561ca80dcea601.tar.bz2
fix misc memory leaks
This fixes a few misc memory leaks reported by asan: - Items of `config->config_chain` are now freed instead of just the list itself - `bar->swaybar_command` is now freed - The result returned by a seat subcommand is now returned instead of leaked
-rw-r--r--sway/commands/seat.c2
-rw-r--r--sway/config.c2
-rw-r--r--sway/config/bar.c1
3 files changed, 3 insertions, 2 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c
index 5b23dcc..aa36ba9 100644
--- a/sway/commands/seat.c
+++ b/sway/commands/seat.c
@@ -50,5 +50,5 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
}
config->handler_context.seat_config = NULL;
- return cmd_results_new(CMD_SUCCESS, NULL);
+ return res ? res : cmd_results_new(CMD_SUCCESS, NULL);
}
diff --git a/sway/config.c b/sway/config.c
index ae8d11e..cd2d18a 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -118,7 +118,7 @@ void free_config(struct sway_config *config) {
}
list_free(config->no_focus);
list_free(config->active_bar_modifiers);
- list_free(config->config_chain);
+ list_free_items_and_destroy(config->config_chain);
list_free(config->command_policies);
list_free(config->feature_policies);
list_free(config->ipc_policies);
diff --git a/sway/config/bar.c b/sway/config/bar.c
index bafef30..2e28fa1 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -46,6 +46,7 @@ void free_bar_config(struct bar_config *bar) {
free(bar->position);
free(bar->hidden_state);
free(bar->status_command);
+ free(bar->swaybar_command);
free(bar->font);
free(bar->separator_symbol);
for (int i = 0; i < bar->bindings->length; i++) {