1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Fix memory leaks in expandos_deinit by Nicolas Collignon, bug #419.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4390 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2006-10-23 10:36:47 +00:00 committed by exg
parent 9da0ca72a5
commit 66c9e22622

View File

@ -260,6 +260,13 @@ EXPANDO_FUNC expando_find_long(const char *key)
return rec == NULL ? NULL : rec->func; return rec == NULL ? NULL : rec->func;
} }
static gboolean free_expando(gpointer key, gpointer value, gpointer user_data)
{
g_free(key);
g_free(value);
return TRUE;
}
/* last person who sent you a MSG */ /* last person who sent you a MSG */
static char *expando_lastmsg(SERVER_REC *server, void *item, int *free_ret) static char *expando_lastmsg(SERVER_REC *server, void *item, int *free_ret)
{ {
@ -698,13 +705,7 @@ void expandos_deinit(void)
for (n = 0; n < sizeof(char_expandos)/sizeof(char_expandos[0]); n++) for (n = 0; n < sizeof(char_expandos)/sizeof(char_expandos[0]); n++)
g_free_not_null(char_expandos[n]); g_free_not_null(char_expandos[n]);
expando_destroy("sysname", expando_sysname); g_hash_table_foreach_remove(expandos, free_expando, NULL);
expando_destroy("sysrelease", expando_sysrelease);
expando_destroy("sysarch", expando_sysarch);
expando_destroy("topic", expando_topic);
expando_destroy("tag", expando_servertag);
expando_destroy("chatnet", expando_chatnet);
g_hash_table_destroy(expandos); g_hash_table_destroy(expandos);
g_free_not_null(last_sent_msg); g_free_not_null(last_sent_msg_body); g_free_not_null(last_sent_msg); g_free_not_null(last_sent_msg_body);