diff options
author | Tim van der Molen <tbvdm@xs4all.nl> | 2011-01-09 18:21:30 +0100 |
---|---|---|
committer | Matthieu Herrb <matthieu.herrb@laas.fr> | 2011-01-09 23:18:26 +0100 |
commit | 65fe1630ad2cabdb9bf46333925aabdc7f61dc06 (patch) | |
tree | 62c402b8c460e355c17a25f0dac7f21e80f9e65f | |
parent | 064e52f367a2b55e6c32c778684da946c319ca81 (diff) |
Fix for invalid free if window has a _NET_WM_NAME property.
In this case xcb_get_wm_name_reply() is not called, so reorganize the
code to not free a result which never was allocated.
Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xwininfo.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -786,9 +786,9 @@ Display_Window_Id (struct wininfo *w, Bool newline_wanted) { #ifdef USE_XCB_ICCCM xcb_get_text_property_reply_t wmn_reply; + uint8_t got_reply = False; #endif xcb_get_property_reply_t *prop; - uint8_t got_reply = False; const char *wm_name = NULL; unsigned int wm_name_len = 0; xcb_atom_t wm_name_encoding = XCB_NONE; @@ -807,10 +807,7 @@ Display_Window_Id (struct wininfo *w, Bool newline_wanted) wm_name = xcb_get_property_value (prop); wm_name_len = xcb_get_property_value_length (prop); wm_name_encoding = prop->type; - got_reply = True; - } - - if (!got_reply) { /* No _NET_WM_NAME, check WM_NAME */ + } else { /* No _NET_WM_NAME, check WM_NAME */ #ifdef USE_XCB_ICCCM got_reply = xcb_get_wm_name_reply (dpy, w->wm_name_cookie, &wmn_reply, NULL); @@ -825,11 +822,10 @@ Display_Window_Id (struct wininfo *w, Bool newline_wanted) wm_name = xcb_get_property_value (prop); wm_name_len = xcb_get_property_value_length (prop); wm_name_encoding = prop->type; - got_reply = True; } #endif } - if (!got_reply || wm_name_len == 0) { + if (wm_name_len == 0) { printf (" (has no name)"); } else { if (wm_name_encoding == XCB_ATOM_STRING) { |