summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compton.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/compton.c b/compton.c
index 021174804..b72dc59bd 100644
--- a/compton.c
+++ b/compton.c
@@ -1573,16 +1573,15 @@ set_opacity(Display *dpy, win *w, unsigned long opacity) {
static void
add_win(Display *dpy, Window id, Window prev, Bool override_redirect) {
+ if (find_win(dpy, id)) {
+ return;
+ }
+
win *new = malloc(sizeof(win));
win **p;
if (!new) return;
- if (find_win(dpy, id)) {
- free(new);
- return;
- }
-
if (prev) {
for (p = &list; *p; p = &(*p)->next) {
if ((*p)->id == prev && !(*p)->destroyed)