fix a few memleaks
authorPhil Sutter <phil@nwl.cc>
Sun, 21 Jun 2009 23:50:15 +0000 (01:50 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 22 Jun 2009 00:00:11 +0000 (02:00 +0200)
src/conky.c
src/x11.c

index 5f15692..6f7bde3 100644 (file)
@@ -7416,7 +7416,6 @@ static void clean_up(void)
                        XFlush(display);
                }
 
-               XFreeGC(display, window.gc);
                free_fonts();
        }
 
@@ -7650,6 +7649,8 @@ static void set_default_configurations(void)
 #endif /* X11 */
 
        for (i = 0; i < MAX_TEMPLATES; i++) {
+               if (template[i])
+                       free(template[i]);
                template[i] = strdup("");
        }
 
@@ -8907,6 +8908,7 @@ int main(int argc, char **argv)
 
        g_signal_pending = 0;
        memset(&info, 0, sizeof(info));
+       memset(template, 0, sizeof(template));
        clear_net_stats();
 
 #ifdef TCP_PORT_MONITOR
index 5ee4446..6692694 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -216,6 +216,7 @@ void set_transparent_background(Window win)
 void destroy_window(void)
 {
        XDestroyWindow(display, window.window);
+       XFreeGC(display, window.gc);
        memset(&window, 0, sizeof(struct conky_window));
 }