From 1f59ceea92c10895a32255ed568152b5bfee9c6f Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Tue, 17 Sep 2013 17:50:50 +0200 Subject: [PATCH] Don't wipe unallocated structures --- rules.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rules.c b/rules.c index 3a034c7..f1272ad 100644 --- a/rules.c +++ b/rules.c @@ -53,11 +53,13 @@ rule_t *find_rule(unsigned int uid) bool is_match(rule_t *r, xcb_window_t win) { xcb_icccm_get_wm_class_reply_t reply; + int8_t success = 0; if (streq(r->cause.name, MATCH_ALL) || - (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL) == 1 + ((success = xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL)) == 1 && (streq(reply.class_name, r->cause.name) || streq(reply.instance_name, r->cause.name)))) { - xcb_icccm_get_wm_class_reply_wipe(&reply); + if (success) + xcb_icccm_get_wm_class_reply_wipe(&reply); return true; } return false; -- 2.44.0