Free individual criteria in free_config

Also free cmd_list when cleaning up a struct criteria.
master
frsfnrrg 6 years ago
parent b3014f7b16
commit 600676688a

@ -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);
} }
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->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);

@ -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);
} }

Loading…
Cancel
Save