]> git.sur5r.net Git - i3/i3/commitdiff
Free owindow when no con_id match or window
authorTony Crisci <tony@dubstepdish.com>
Wed, 19 Mar 2014 08:56:34 +0000 (04:56 -0400)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 21 Mar 2014 18:26:13 +0000 (19:26 +0100)
This memory leak is related to matching on con_id or matching when the
container has a null window. In that case, windows that do not match
would leak the owindow struct.

src/commands.c

index f05d9758a9f64e348682d2fa1284da9b8a199945..0f4315c1ae3f36bef814eabe3466f12bec7f122c 100644 (file)
@@ -298,15 +298,16 @@ void cmd_criteria_match_windows(I3_CMD) {
             if (current_match->con_id == current->con) {
                 DLOG("matches container!\n");
                 TAILQ_INSERT_TAIL(&owindows, current, owindows);
+            } else {
+                DLOG("doesnt match\n");
+                free(current);
             }
         } else if (current_match->mark != NULL && current->con->mark != NULL &&
                    regex_matches(current_match->mark, current->con->mark)) {
             DLOG("match by mark\n");
             TAILQ_INSERT_TAIL(&owindows, current, owindows);
         } else {
-            if (current->con->window == NULL)
-                continue;
-            if (match_matches_window(current_match, current->con->window)) {
+            if (current->con->window && match_matches_window(current_match, current->con->window)) {
                 DLOG("matches window!\n");
                 TAILQ_INSERT_TAIL(&owindows, current, owindows);
             } else {