1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

* Fix leaks

* Fix HUP behaviour - scripts are now reloaded on HUP
* Remove unneccessary calls to llua_close()
This commit is contained in:
Toni Spets 2009-05-15 23:35:18 +03:00
parent b5934e5f69
commit 66ba6e36c9
2 changed files with 11 additions and 3 deletions

View File

@ -854,10 +854,10 @@ static void free_text_objects(struct text_object *root)
#endif #endif
#ifdef HAVE_LUA #ifdef HAVE_LUA
case OBJ_lua: case OBJ_lua:
llua_close(); free(data.s);
break; break;
case OBJ_lua_bar: case OBJ_lua_bar:
llua_close(); free(data.s);
break; break;
#endif #endif
case OBJ_pre_exec: case OBJ_pre_exec:
@ -4192,7 +4192,7 @@ static void generate_text_internal(char *p, int p_max_size,
#ifdef X11 #ifdef X11
OBJ(lua_bar) { OBJ(lua_bar) {
int per; int per;
if(llua_getpercent(strdup(obj->data.s), &per)) { if(llua_getpercent(obj->data.s, &per)) {
new_bar(p, obj->a, obj->b, (per/100.0 * 255)); new_bar(p, obj->a, obj->b, (per/100.0 * 255));
} }
} }
@ -6646,6 +6646,10 @@ static void reload_config(void)
tcp_portmon_clear(); tcp_portmon_clear();
#endif #endif
#ifdef HAVE_LUA
llua_close();
#endif
if (current_config) { if (current_config) {
clear_fs_stats(); clear_fs_stats();
load_config_file(current_config); load_config_file(current_config);
@ -6747,6 +6751,9 @@ static void clean_up(void)
#ifdef RSS #ifdef RSS
free_rss_info(); free_rss_info();
#endif #endif
#ifdef HAVE_LUA
llua_close();
#endif
if (specials) { if (specials) {
unsigned int i; unsigned int i;

View File

@ -40,6 +40,7 @@ void llua_init()
void llua_load(const char *script) void llua_load(const char *script)
{ {
int error; int error;
if(!lua_L) return;
error = luaL_loadfile(lua_L, script); error = luaL_loadfile(lua_L, script);
if(error) { if(error) {
ERR("llua_load: %s", lua_tostring(lua_L, -1)); ERR("llua_load: %s", lua_tostring(lua_L, -1));