]> Pileus Git - wmpus/commitdiff
Work on memory cleanup
authorAndy Spencer <andy753421@gmail.com>
Sun, 19 Apr 2015 01:09:25 +0000 (01:09 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 19 Apr 2015 03:10:56 +0000 (03:10 +0000)
sys-xcb.c

index c9259c3ef3cfe0366ca838714d74f7db2e28b755..b1176a82612215265861193b73eea64b05ac35cf 100644 (file)
--- a/sys-xcb.c
+++ b/sys-xcb.c
@@ -345,7 +345,9 @@ static xcb_atom_t do_intern_atom(const char *name)
        if (!reply)
                return warn("do_intern_atom: no reply");
 
        if (!reply)
                return warn("do_intern_atom: no reply");
 
-       return reply->atom;
+       xcb_atom_t atom = reply->atom;
+       free(reply);
+       return atom;
 }
 
 static int do_ewmh_init_atoms(void)
 }
 
 static int do_ewmh_init_atoms(void)
@@ -399,7 +401,9 @@ static xcb_pixmap_t do_alloc_color(uint32_t rgb)
                return warn("do_alloc_color: no reply");
 
        printf("do_alloc_color: %06x -> %06x\n", rgb, reply->pixel);
                return warn("do_alloc_color: no reply");
 
        printf("do_alloc_color: %06x -> %06x\n", rgb, reply->pixel);
-       return reply->pixel;
+       xcb_pixmap_t pixel = reply->pixel;
+       free(reply);
+       return pixel;
 }
 
 static void do_grab_pointer(xcb_event_mask_t mask)
 }
 
 static void do_grab_pointer(xcb_event_mask_t mask)
@@ -1100,7 +1104,9 @@ void sys_exit(void)
 void sys_free(void)
 {
        printf("sys_free\n");
 void sys_free(void)
 {
        printf("sys_free\n");
-       if (conn)
+       if (conn) {
+               xcb_ewmh_connection_wipe(&ewmh);
                xcb_disconnect(conn);
                xcb_disconnect(conn);
+       }
        conn = NULL;
 }
        conn = NULL;
 }