diff --git a/src/conky.c b/src/conky.c index e5cfa0eb..eddd3d1e 100644 --- a/src/conky.c +++ b/src/conky.c @@ -2394,6 +2394,10 @@ void clean_up(void *memtofree1, void* memtofree2) info.first_process = NULL; } +#ifdef X11 + free_desktop_info(); +#endif /* X11 */ + free_text_objects(&global_root_object, 0); if (tmpstring1) { free(tmpstring1); diff --git a/src/core.c b/src/core.c index 392cd734..c8764f16 100644 --- a/src/core.c +++ b/src/core.c @@ -1803,6 +1803,8 @@ void free_text_objects(struct text_object *root, int internal) { struct text_object *obj; + (void)internal; + if (!root->prev) { return; } @@ -1817,20 +1819,7 @@ void free_text_objects(struct text_object *root, int internal) } switch (obj->type) { -#ifdef X11 - case OBJ_desktop: - case OBJ_desktop_number: - case OBJ_desktop_name: - if(info.x11.desktop.name && !internal) { - free(info.x11.desktop.name); - info.x11.desktop.name = NULL; - } - if(info.x11.desktop.all_names && !internal) { - free(info.x11.desktop.all_names); - info.x11.desktop.all_names = NULL; - } - break; -#endif /* X11 */ + default: break; } obj_free_loop_tail: if(obj->sub) { diff --git a/src/x11.c b/src/x11.c index cd8b7e4b..cdae2bfc 100644 --- a/src/x11.c +++ b/src/x11.c @@ -737,6 +737,18 @@ void print_desktop_name(struct text_object *obj, char *p, int p_max_size) } } +void free_desktop_info(void) +{ + if(info.x11.desktop.name) { + free(info.x11.desktop.name); + info.x11.desktop.name = NULL; + } + if(info.x11.desktop.all_names) { + free(info.x11.desktop.all_names); + info.x11.desktop.all_names = NULL; + } +} + #ifdef OWN_WINDOW /* reserve window manager space */ void set_struts(int sidenum) diff --git a/src/x11.h b/src/x11.h index b959bca0..fbed45f8 100644 --- a/src/x11.h +++ b/src/x11.h @@ -99,6 +99,7 @@ void print_monitor_number(struct text_object *, char *, int); void print_desktop(struct text_object *, char *, int); void print_desktop_number(struct text_object *, char *, int); void print_desktop_name(struct text_object *, char *, int); +void free_desktop_info(void); #ifdef HAVE_XDBE void xdbe_swap_buffers(void);