mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
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
This commit is contained in:
parent
4d5200a4e1
commit
c371640471
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user