Index: irc.c
===================================================================
--- irc.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ irc.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -210,8 +210,5 @@
 	
 	while( irc->users )
-	{
-		irc_user_t *iu = irc->users->data;
-		irc_user_free( irc, iu->nick );
-	}
+		irc_user_free( irc, (irc_user_t *) irc->users->data );
 	
 	while( irc->channels )
Index: irc.h
===================================================================
--- irc.h	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ irc.h	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -204,5 +204,5 @@
 /* irc_user.c */
 irc_user_t *irc_user_new( irc_t *irc, const char *nick );
-int irc_user_free( irc_t *irc, const char *nick );
+int irc_user_free( irc_t *irc, irc_user_t *iu );
 irc_user_t *irc_user_by_name( irc_t *irc, const char *nick );
 int irc_user_set_nick( irc_user_t *iu, const char *new );
Index: irc_im.c
===================================================================
--- irc_im.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ irc_im.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -74,5 +74,5 @@
 static gboolean bee_irc_user_free( bee_t *bee, bee_user_t *bu )
 {
-	return irc_user_free( bee->ui_data, bu->ui_data );
+	return irc_user_free( bee->ui_data, (irc_user_t *) bu->ui_data );
 }
 
Index: irc_user.c
===================================================================
--- irc_user.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ irc_user.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -47,10 +47,9 @@
 }
 
-int irc_user_free( irc_t *irc, const char *nick )
+int irc_user_free( irc_t *irc, irc_user_t *iu )
 {
-	irc_user_t *iu;
 	GSList *l;
 	
-	if( !( iu = irc_user_by_name( irc, nick ) ) )
+	if( !iu )
 		return 0;
 	
Index: protocols/bee.h
===================================================================
--- protocols/bee.h	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ protocols/bee.h	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -85,5 +85,5 @@
 /* bee_user.c */
 bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle );
-int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle );
+int bee_user_free( bee_t *bee, bee_user_t *bu );
 bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle );
 int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags );
Index: protocols/bee_user.c
===================================================================
--- protocols/bee_user.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ protocols/bee_user.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -46,9 +46,7 @@
 }
 
-int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle )
+int bee_user_free( bee_t *bee, bee_user_t *bu )
 {
-	bee_user_t *bu;
-	
-	if( ( bu = bee_user_by_handle( bee, ic, handle ) ) == NULL )
+	if( !bu )
 		return 0;
 	
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ protocols/nogaim.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -327,10 +327,13 @@
 	ic->away = NULL;
 	
-	for( l = bee->users; l; l = l->next )
+	for( l = bee->users; l; )
 	{
 		bee_user_t *bu = l->data;
+		GSList *next = l->next;
 		
 		if( bu->ic == ic )
-			bee_user_free( bee, ic, bu->handle );
+			bee_user_free( bee, bu );
+		
+		l = next;
 	}
 	
@@ -403,5 +406,5 @@
 void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group )
 {
-	bee_user_free( ic->bee, ic, handle );
+	bee_user_free( ic->bee, bee_user_by_handle( ic->bee, ic, handle ) );
 }
 
Index: root_commands.c
===================================================================
--- root_commands.c	(revision d986463c9e026b2a5f003f44db3105aa5449fc27)
+++ root_commands.c	(revision eabc9d2c1b1d29aeb47162da64ce2b607c3d43ff)
@@ -633,5 +633,5 @@
 	bu->ic->acc->prpl->remove_buddy( bu->ic, bu->handle, NULL );
 	nick_del( bu->ic->acc, bu->handle );
-	irc_user_free( irc, cmd[1] );
+	//TODO(wilmer): bee_user_free() and/or let the IM mod do it? irc_user_free( irc, cmd[1] );
 	
 	irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
