diff options
author | Julien Danjou <julien@danjou.info> | 2008-08-06 16:23:36 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2008-08-06 16:23:36 +0200 |
commit | 73d2e818e5a4ec362061cd95031a0cf2d8d02f96 (patch) | |
tree | d6d768f30eda10bdfe55c6863a846a99843db9b4 | |
parent | d504051ff2a11608ed0753233f6b069fa1bfc555 (diff) |
icccm: fix memory leak in xcb_get_wm_hints()
Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r-- | icccm/icccm.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/icccm/icccm.c b/icccm/icccm.c index ff89d3e..250c4c3 100644 --- a/icccm/icccm.c +++ b/icccm/icccm.c @@ -670,7 +670,7 @@ xcb_get_wm_hints (xcb_connection_t *c, xcb_window_t window) { xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *rep; + xcb_get_property_reply_t *rep = NULL; xcb_wm_hints_t *hints; long length; @@ -685,22 +685,19 @@ xcb_get_wm_hints (xcb_connection_t *c, if ((rep->type != WM_HINTS) || (length < (XCB_NUM_WM_HINTS_ELEMENTS - 1)) || (rep->format != 32)) - { - free (rep); - return NULL; - } + goto bailout; + hints = xcb_alloc_wm_hints(); if (!hints) - { - free (rep); - return NULL; - } + goto bailout; memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (rep), length * rep->format >> 3); if (length < XCB_NUM_WM_HINTS_ELEMENTS) hints->window_group = XCB_NONE; + bailout: + free(rep); return hints; } |