From b40f499e7be9f86f636aa6fd38e6dfc5c47410e3 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Fri, 5 Sep 2025 23:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20get=5Fwindow=5Ftag=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=86=85=E5=AD=98=E6=9C=AA=E9=87=8A=E6=94=BE?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/xcb/wm-extension.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/xcb/wm-extension.c b/src/xcb/wm-extension.c index f2c1808..6e5efb8 100644 --- a/src/xcb/wm-extension.c +++ b/src/xcb/wm-extension.c @@ -182,14 +182,16 @@ bool get_window_tag(xcb_window_t window, client_tag_info_t *client_info) { XCB_ATOM_CARDINAL, 0, 2); xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, cookie, NULL); int length = xcb_get_property_value_length(reply); - if (length >= 2) { + bool result = length >= 2; + if (result) { uint32_t *data = xcb_get_property_value(reply); client_info->tags = data[0]; client_info->monitor_index = data[1]; - return true; - } else { - return false; } + + free(reply); + + return result; } void set_window_tag(xcb_window_t window, client_tag_info_t *client_info) {