From 487586868988bdc48bb657c8e8798ace2a4438a2 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 31 Jul 2011 17:12:37 +0200 Subject: [PATCH] Bugfix: Free property replies in their handlers --- src/handlers.c | 5 ++--- src/window.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index 2e3ad7aa..b20ef327 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -986,9 +986,8 @@ static int property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) propr = xcb_get_property_reply(conn, cookie, 0); } - ret = handler->cb(NULL, conn, state, window, atom, propr); - FREE(propr); - return ret; + /* the handler will free() the reply */ + return handler->cb(NULL, conn, state, window, atom, propr); } /* diff --git a/src/window.c b/src/window.c index b6aaae9e..0449b1f5 100644 --- a/src/window.c +++ b/src/window.c @@ -37,6 +37,8 @@ void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool bef return; run_assignments(win); + + free(prop); } /* @@ -80,6 +82,8 @@ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool befo return; run_assignments(win); + + free(prop); } /* @@ -121,6 +125,8 @@ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bo return; run_assignments(win); + + free(prop); } /* @@ -140,6 +146,8 @@ void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop) { DLOG("Client leader changed to %08x\n", *leader); win->leader = *leader; + + free(prop); } /* @@ -159,6 +167,8 @@ void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop) DLOG("Transient for changed to %08x\n", transient_for); win->transient_for = transient_for; + + free(prop); } /* @@ -179,4 +189,6 @@ void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop) strut[0], strut[1], strut[2], strut[3]); win->reserved = (struct reservedpx){ strut[0], strut[1], strut[2], strut[3] }; + + free(prop); } -- 2.39.5