X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=1751412f18b4a70c6c3d34dca787b01f9800bcd9;hb=972d8078dac803b2896f7bfb3958d9e801e3321a;hp=73e3fc7ddbad38ee3b7c78288f48974572799aa5;hpb=a88b31468ea39bacfdf04e60b8c8ea6326c2e9e6;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 73e3fc7..1751412 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -2299,8 +2299,10 @@ find_window(xcb_window_t id) return (NULL); /* if we were looking for the parent return that window instead */ - if (r->parent == 0 || r->root == r->parent) + if (r->parent == 0 || r->root == r->parent) { + free(r); return (NULL); + } /* look for parent */ for (i = 0; i < num_screens; i++) @@ -3730,12 +3732,10 @@ get_win_name(xcb_window_t win) if (xcb_icccm_get_wm_name_reply(conn, c, &r, NULL)) { if (r.name_len > 0) { name = malloc(r.name_len + 1); - if (!name) { - xcb_icccm_get_text_property_reply_wipe(&r); - return (NULL); + if (name) { + memcpy(name, r.name, r.name_len); + name[r.name_len] = '\0'; } - memcpy(name, r.name, r.name_len); - name[r.name_len] = '\0'; } xcb_icccm_get_text_property_reply_wipe(&r); }