mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 04:17:33 +00:00
Fix some minor memleaks, fix crash on reload.
It seems that closing xft fonts on reload is a bad idea, but this seems to result in a memory leak. As far as I can tell, the leak doesn't grow beyond the initial allocation however.
This commit is contained in:
parent
39f01e216b
commit
9acf0bb4c0
@ -2307,6 +2307,7 @@ static void main_loop(void)
|
|||||||
current_config,
|
current_config,
|
||||||
IN_MODIFY);
|
IN_MODIFY);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LUA
|
#ifdef HAVE_LUA
|
||||||
else {
|
else {
|
||||||
|
@ -131,7 +131,13 @@ void free_fonts(void)
|
|||||||
for (i = 0; i <= font_count; i++) {
|
for (i = 0; i <= font_count; i++) {
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
if (use_xft) {
|
if (use_xft) {
|
||||||
XftFontClose(display, fonts[i].xftfont);
|
/*
|
||||||
|
* Do we not need to close fonts with Xft? Unsure. Not freeing the
|
||||||
|
* fonts seems to incur a slight memory leak, but it also prevents
|
||||||
|
* a crash.
|
||||||
|
*
|
||||||
|
* XftFontClose(display, fonts[i].xftfont);
|
||||||
|
*/
|
||||||
fonts[i].xftfont = 0;
|
fonts[i].xftfont = 0;
|
||||||
} else
|
} else
|
||||||
#endif /* XFT */
|
#endif /* XFT */
|
||||||
|
10
src/llua.c
10
src/llua.c
@ -304,6 +304,14 @@ void llua_close(void)
|
|||||||
free(draw_post_hook);
|
free(draw_post_hook);
|
||||||
draw_post_hook = 0;
|
draw_post_hook = 0;
|
||||||
}
|
}
|
||||||
|
if (startup_hook) {
|
||||||
|
free(startup_hook);
|
||||||
|
startup_hook = 0;
|
||||||
|
}
|
||||||
|
if (shutdown_hook) {
|
||||||
|
free(shutdown_hook);
|
||||||
|
shutdown_hook = 0;
|
||||||
|
}
|
||||||
if(!lua_L) return;
|
if(!lua_L) return;
|
||||||
lua_close(lua_L);
|
lua_close(lua_L);
|
||||||
lua_L = NULL;
|
lua_L = NULL;
|
||||||
@ -399,11 +407,13 @@ void llua_set_number(const char *key, double value)
|
|||||||
|
|
||||||
void llua_set_startup_hook(const char *args)
|
void llua_set_startup_hook(const char *args)
|
||||||
{
|
{
|
||||||
|
if (startup_hook) free(startup_hook);
|
||||||
startup_hook = strdup(args);
|
startup_hook = strdup(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void llua_set_shutdown_hook(const char *args)
|
void llua_set_shutdown_hook(const char *args)
|
||||||
{
|
{
|
||||||
|
if (shutdown_hook) free(shutdown_hook);
|
||||||
shutdown_hook = strdup(args);
|
shutdown_hook = strdup(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ static void *imap_thread(void *arg)
|
|||||||
recvbuf[numbytes] = '\0';
|
recvbuf[numbytes] = '\0';
|
||||||
DBGP2("imap_thread() received: %s", recvbuf);
|
DBGP2("imap_thread() received: %s", recvbuf);
|
||||||
if (strlen(recvbuf) > 2) {
|
if (strlen(recvbuf) > 2) {
|
||||||
unsigned long messages, recent;
|
unsigned long messages, recent = 0;
|
||||||
char *buf = recvbuf;
|
char *buf = recvbuf;
|
||||||
char force_check = 0;
|
char force_check = 0;
|
||||||
buf = strstr(buf, "EXISTS");
|
buf = strstr(buf, "EXISTS");
|
||||||
|
@ -238,11 +238,13 @@ static int get_argb_visual(Visual** visual, int *depth) {
|
|||||||
*visual = visual_list[i].visual;
|
*visual = visual_list[i].visual;
|
||||||
*depth = visual_list[i].depth;
|
*depth = visual_list[i].depth;
|
||||||
DBGP("Found ARGB Visual");
|
DBGP("Found ARGB Visual");
|
||||||
|
XFree(visual_list);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no argb visual available
|
// no argb visual available
|
||||||
DBGP("No ARGB Visual found");
|
DBGP("No ARGB Visual found");
|
||||||
|
XFree(visual_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* USE_ARGB */
|
||||||
|
Loading…
Reference in New Issue
Block a user