Fixed floatbar X11 leak.
authorArmin Novak <armin.novak@thincast.com>
Mon, 1 Oct 2018 08:49:30 +0000 (10:49 +0200)
committerArmin Novak <armin.novak@thincast.com>
Mon, 1 Oct 2018 08:49:30 +0000 (10:49 +0200)
client/X11/xf_floatbar.c

index 33df891..dceb08a 100644 (file)
@@ -203,6 +203,9 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window)
        xfFloatbar* floatbar;
        XWindowAttributes attr;
        int i, width;
+       if (!xfc)
+               return NULL;
+
        floatbar = (xfFloatbar*) calloc(1, sizeof(xfFloatbar));
        floatbar->locked = TRUE;
        XGetWindowAttributes(xfc->display, window, &attr);
@@ -297,6 +300,8 @@ static void xf_floatbar_event_expose(xfContext* xfc, XEvent* event)
        XSetForeground(xfc->display, gc, xf_floatbar_get_color(xfc, FLOATBAR_COLOR_FOREGROUND));
        XDrawString(xfc->display, floatbar->handle, gc, floatbar->width / 2 - len * 2, 15,
                    xfc->context.settings->ServerHostname, len);
+       XFreeGC(xfc->display, gc);
+       XFreeGC(xfc->display, shape_gc);
 }
 
 static xfFloatbarButton* xf_floatbar_get_button(xfContext* xfc, XEvent* event)