On startup, don't leak memory when we enumerate existing windows.

The behaviour until now was to ask X for the windows name (which is
malloced) then drop that on the floor and do nothing with it. Skip this
foolery and just skip the window. I don't believe I never noticed this before!

"you can has ok" okan@
This commit is contained in:
oga 2009-01-15 17:23:12 +00:00
parent 49e218cf53
commit 5c757cc7f4

View File

@ -229,11 +229,8 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
for (i = 0; i < nwins; i++) { for (i = 0; i < nwins; i++) {
XGetWindowAttributes(X_Dpy, wins[i], &winattr); XGetWindowAttributes(X_Dpy, wins[i], &winattr);
if (winattr.override_redirect || if (winattr.override_redirect ||
winattr.map_state != IsViewable) { winattr.map_state != IsViewable)
char *name;
XFetchName(X_Dpy, wins[i], &name);
continue; continue;
}
client_new(wins[i], sc, winattr.map_state != IsUnmapped); client_new(wins[i], sc, winattr.map_state != IsUnmapped);
} }
XFree(wins); XFree(wins);