about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index 4ad7cea..265ffb9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1246,10 +1246,9 @@ run(void) {
 void
 scan(void) {
 	unsigned int i, num;
-	Window *wins, d1, d2;
+	Window d1, d2, *wins = NULL;
 	XWindowAttributes wa;
 
-	wins = NULL;
 	if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
 		for(i = 0; i < num; i++) {
 			if(!XGetWindowAttributes(dpy, wins[i], &wa)
@@ -1265,9 +1264,9 @@ scan(void) {
 			&& (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
 				manage(wins[i], &wa);
 		}
+		if(wins)
+			XFree(wins);
 	}
-	if(wins)
-		XFree(wins);
 }
 
 void