[Xcb-commit] icccm

Julien Danjou jdanjou at kemper.freedesktop.org
Wed Aug 6 07:24:20 PDT 2008


 icccm/icccm.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 73d2e818e5a4ec362061cd95031a0cf2d8d02f96
Author: Julien Danjou <julien at danjou.info>
Date:   Wed Aug 6 16:23:36 2008 +0200

    icccm: fix memory leak in xcb_get_wm_hints()
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

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;
 }
 


More information about the xcb-commit mailing list