diff options
author | Timo Sirainen <cras@irssi.org> | 2002-01-28 15:20:57 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-01-28 15:20:57 +0000 |
commit | 747d0f19ca54053601a61f00f331a174daa3afb9 (patch) | |
tree | c1fef5a3e7b391ca8c697475790b35ab1ee6db51 | |
parent | 08c23ce6d4c21f7cee9be2248d0fec15c153a23a (diff) | |
download | irssi-747d0f19ca54053601a61f00f331a174daa3afb9.zip |
Fixed a few minor memleaks. Don't use g_strdup() in lib-popt because it may
be freed with a real free() call instead of g_free().
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2352 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/core/chatnets.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-chatnets.c | 18 | ||||
-rw-r--r-- | src/irc/core/irc-servers.c | 1 | ||||
-rw-r--r-- | src/irc/core/servers-redirect.c | 2 | ||||
-rw-r--r-- | src/lib-popt/popt.c | 3 |
5 files changed, 23 insertions, 3 deletions
diff --git a/src/core/chatnets.c b/src/core/chatnets.c index 705dd2e7..62c31c98 100644 --- a/src/core/chatnets.c +++ b/src/core/chatnets.c @@ -193,8 +193,6 @@ void chatnets_init(void) void chatnets_deinit(void) { - while (chatnets != NULL) - chatnet_destroy(chatnets->data); module_uniq_destroy("CHATNET"); signal_remove("event connected", (SIGNAL_FUNC) sig_connected); diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c index 5d375869..1e03110a 100644 --- a/src/irc/core/irc-chatnets.c +++ b/src/irc/core/irc-chatnets.c @@ -75,14 +75,32 @@ static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node) iconfig_node_set_int(node, "max_whois", rec->max_whois); } +static void sig_chatnet_destroyed(IRC_CHATNET_REC *rec) +{ + if (IS_IRC_CHATNET(rec)) + g_free(rec->usermode); +} + + void irc_chatnets_init(void) { signal_add("chatnet read", (SIGNAL_FUNC) sig_chatnet_read); signal_add("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved); + signal_add("chatnet destroyed", (SIGNAL_FUNC) sig_chatnet_destroyed); } void irc_chatnets_deinit(void) { + GSList *tmp, *next; + + for (tmp = chatnets; tmp != NULL; tmp = next) { + CHATNET_REC *rec = tmp->data; + + if (IS_IRC_CHATNET(rec)) + chatnet_destroy(rec); + } + signal_remove("chatnet read", (SIGNAL_FUNC) sig_chatnet_read); signal_remove("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved); + signal_remove("chatnet destroyed", (SIGNAL_FUNC) sig_chatnet_destroyed); } diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index a8ebb607..91935fb5 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -277,6 +277,7 @@ static void sig_disconnected(IRC_SERVER_REC *server) g_slist_free(server->cmdqueue); server->cmdqueue = NULL; + g_free_and_null(server->wanted_usermode); g_free_and_null(server->real_address); g_free_and_null(server->usermode); g_free_and_null(server->userhost); diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 1a1d159d..802bd0aa 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -113,6 +113,8 @@ void server_redirect_destroy(REDIRECT_REC *rec) g_free_not_null(rec->arg); g_free_not_null(rec->failure_signal); g_free_not_null(rec->default_signal); + g_free_not_null(rec->first_signal); + g_free_not_null(rec->last_signal); g_slist_foreach(rec->signals, (GFunc) g_free, NULL); g_slist_free(rec->signals); g_free(rec); diff --git a/src/lib-popt/popt.c b/src/lib-popt/popt.c index c09a0b30..d2fe34f7 100644 --- a/src/lib-popt/popt.c +++ b/src/lib-popt/popt.c @@ -452,7 +452,8 @@ int poptGetNextOpt(poptContext con) { if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL) - con->finalArgv[con->finalArgvCount++] = g_strdup(con->os->nextArg); + con->finalArgv[con->finalArgvCount++] = + strcpy(malloc(strlen(con->os->nextArg)), con->os->nextArg); } if (dup) g_free(dup); |