aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-26 23:11:02 -0400
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-26 23:11:02 -0400
commit63a520b8ce1776442f2f79528ddd23fb0de51f94 (patch)
tree65a9df033b0f993f516ae9b896401dd16f9f231f
parentb9e020af6c6a88392caa9edd120fb576ec971430 (diff)
Collect that garbage.
-rw-r--r--irc.c5
-rw-r--r--irc_channel.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/irc.c b/irc.c
index 7c7445e3..f21dc974 100644
--- a/irc.c
+++ b/irc.c
@@ -210,6 +210,9 @@ void irc_free( irc_t * irc )
irc_user_free( irc, iu->nick );
}
+ while( irc->channels )
+ irc_channel_free( irc->channels->data );
+
if( irc->ping_source_id > 0 )
b_event_remove( irc->ping_source_id );
if( irc->r_watch_source_id > 0 )
@@ -591,7 +594,9 @@ int irc_check_login( irc_t *irc )
irc->user = irc_user_new( irc, iu->nick );
irc->user->user = iu->user;
irc->user->fullname = iu->fullname;
+ g_free( iu->fullname );
g_free( iu->nick );
+ g_free( iu->host );
g_free( iu );
irc->umode[0] = '\0';
diff --git a/irc_channel.c b/irc_channel.c
index 17904d72..c58d6b1c 100644
--- a/irc_channel.c
+++ b/irc_channel.c
@@ -59,6 +59,23 @@ irc_channel_t *irc_channel_by_name( irc_t *irc, const char *name )
return NULL;
}
+int irc_channel_free( irc_channel_t *ic )
+{
+ irc_t *irc = ic->irc;
+
+ if( ic->flags & IRC_CHANNEL_JOINED )
+ irc_channel_del_user( ic, irc->user );
+
+ irc->channels = g_slist_remove( irc->channels, ic );
+ g_slist_free( ic->users );
+
+ g_free( ic->name );
+ g_free( ic->topic );
+ g_free( ic );
+
+ return 1;
+}
+
int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu )
{
if( g_slist_find( ic->users, iu ) != NULL )