From e4a1268b2ad84ddd6b748b13ab10f3b6c4379174 Mon Sep 17 00:00:00 2001 From: Consolatis <40171-Consolatis@users.noreply.gitlab.freedesktop.org> Date: Mon, 11 May 2026 02:45:20 +0200 Subject: [PATCH] Revert "xwm: fix memory leak" This reverts commit 02abf1cd2839db5bef27b3947fc61a53fddef18f. The change doesn't make sense. It causes a use-after-free when trying to read the pixel data of the icon. The docs clearly state to use 'xcb_ewmh_get_wm_icon_reply_wipe()' when using the function which correctly frees the reply *after* processing the pixel data. --- xwayland/xwm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 6d73c122a..e44a11743 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1157,10 +1157,12 @@ bool wlr_xwayland_surface_fetch_icon( return false; } - bool ok = xcb_ewmh_get_wm_icon_from_reply(icon_reply, reply); - free(reply); + if (!xcb_ewmh_get_wm_icon_from_reply(icon_reply, reply)) { + free(reply); + return false; + } - return ok; + return true; } static xcb_get_property_cookie_t get_property(struct wlr_xwm *xwm,