]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Free old criteria matching window list (Thanks piroko)
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 27 Jan 2012 21:47:55 +0000 (21:47 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 27 Jan 2012 21:47:55 +0000 (21:47 +0000)
src/commands.c

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