summaryrefslogtreecommitdiff
path: root/src/fe-common/core
diff options
context:
space:
mode:
authorValentin Batz <senneth@irssi.org>2005-05-14 17:53:49 +0000
committervb <vb@dbcabf3a-b0e7-0310-adc4-f8d773084564>2005-05-14 17:53:49 +0000
commitc371640471d3dc47dd6cd48dcec819c725637890 (patch)
tree63d7203ce3587e3d0814b9050ee246f9eab0bf9c /src/fe-common/core
parent4d5200a4e1c7647e34b5fc490ec4fa304182f1f0 (diff)
downloadirssi-c371640471d3dc47dd6cd48dcec819c725637890.zip
Fixed leaking in chat-completion (http://bugs.irssi.org/?do=details&id=249), patch by Toby Peterson
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3754 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core')
-rw-r--r--src/fe-common/core/chat-completion.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c
index fbd3d1d8..84504aa0 100644
--- a/src/fe-common/core/chat-completion.c
+++ b/src/fe-common/core/chat-completion.c
@@ -77,6 +77,14 @@ static void last_msg_dec_owns(GSList *list)
}
}
+static void last_msg_destroy(GSList **list, LAST_MSG_REC *rec)
+{
+ *list = g_slist_remove(*list, rec);
+
+ g_free(rec->nick);
+ g_free(rec);
+}
+
static void last_msg_add(GSList **list, const char *nick, int own, int max)
{
LAST_MSG_REC *rec;
@@ -97,8 +105,7 @@ static void last_msg_add(GSList **list, const char *nick, int own, int max)
rec->nick = g_strdup(nick);
if ((int)g_slist_length(*list) == max) {
- *list = g_slist_remove(*list,
- g_slist_last(*list)->data);
+ last_msg_destroy(list, g_slist_last(*list)->data);
}
rec->own = own ? max : 0;
@@ -110,14 +117,6 @@ static void last_msg_add(GSList **list, const char *nick, int own, int max)
*list = g_slist_prepend(*list, rec);
}
-static void last_msg_destroy(GSList **list, LAST_MSG_REC *rec)
-{
- *list = g_slist_remove(*list, rec);
-
- g_free(rec->nick);
- g_free(rec);
-}
-
void completion_last_message_add(const char *nick)
{
g_return_if_fail(nick != NULL);