Bugfix: Free old criteria matching window list (Thanks piroko)

This commit is contained in:
Michael Stapelberg 2012-01-27 21:47:55 +00:00
parent d22458cde0
commit 76ad5dac63
1 changed files with 9 additions and 2 deletions

View File

@ -328,13 +328,20 @@ void cmd_MIGRATION_validate() {
******************************************************************************/ ******************************************************************************/
char *cmd_criteria_init(Match *current_match) { char *cmd_criteria_init(Match *current_match) {
Con *con;
owindow *ow;
DLOG("Initializing criteria, current_match = %p\n", current_match); DLOG("Initializing criteria, current_match = %p\n", current_match);
match_init(current_match); match_init(current_match);
while (!TAILQ_EMPTY(&owindows)) {
ow = TAILQ_FIRST(&owindows);
TAILQ_REMOVE(&owindows, ow, owindows);
free(ow);
}
TAILQ_INIT(&owindows); TAILQ_INIT(&owindows);
/* copy all_cons */ /* copy all_cons */
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) { TAILQ_FOREACH(con, &all_cons, all_cons) {
owindow *ow = smalloc(sizeof(owindow)); ow = smalloc(sizeof(owindow));
ow->con = con; ow->con = con;
TAILQ_INSERT_TAIL(&owindows, ow, owindows); TAILQ_INSERT_TAIL(&owindows, ow, owindows);
} }