Free individual criteria in free_config

Also free cmd_list when cleaning up a struct criteria.
This commit is contained in:
frsfnrrg 2018-07-17 11:19:32 -04:00
parent b3014f7b16
commit 600676688a
2 changed files with 8 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include "sway/input/seat.h" #include "sway/input/seat.h"
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/config.h" #include "sway/config.h"
#include "sway/criteria.h"
#include "sway/tree/arrange.h" #include "sway/tree/arrange.h"
#include "sway/tree/layout.h" #include "sway/tree/layout.h"
#include "sway/tree/workspace.h" #include "sway/tree/workspace.h"
@ -105,7 +106,12 @@ void free_config(struct sway_config *config) {
} }
list_free(config->seat_configs); list_free(config->seat_configs);
} }
list_free(config->criteria); if (config->criteria) {
for (int i = 0; i < config->criteria->length; ++i) {
criteria_destroy(config->criteria->items[i]);
}
list_free(config->criteria);
}
list_free(config->no_focus); list_free(config->no_focus);
list_free(config->active_bar_modifiers); list_free(config->active_bar_modifiers);
list_free(config->config_chain); list_free(config->config_chain);

View File

@ -37,7 +37,7 @@ void criteria_destroy(struct criteria *criteria) {
pcre_free(criteria->con_mark); pcre_free(criteria->con_mark);
pcre_free(criteria->window_role); pcre_free(criteria->window_role);
free(criteria->workspace); free(criteria->workspace);
free(criteria->cmdlist);
free(criteria->raw); free(criteria->raw);
free(criteria); free(criteria);
} }