aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-06-14 00:31:18 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2007-06-14 00:31:18 +0100
commit43d8cc5909aa45aee0b3368e70275469b0f8de22 (patch)
tree744e33ffe045c6384999aed9c153ca17e0deaccf
parent7e9dc74b15901b182be2a1d20bafdba696e4f5f2 (diff)
Fixed a memory management problem that caused some strange nickname issues.
-rw-r--r--protocols/nogaim.c8
-rw-r--r--user.c1
2 files changed, 7 insertions, 2 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 6c564c8c..a1a97dc3 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -446,7 +446,7 @@ void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick )
{
user_t *u = user_findhandle( ic, handle );
- char newnick[MAX_NICK_LENGTH+1];
+ char newnick[MAX_NICK_LENGTH+1], *orig_nick;
if( u && !u->online && !nick_saved( ic->acc, handle ) )
{
@@ -464,7 +464,11 @@ void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick )
nick_dedupe( ic->acc, handle, newnick );
- user_rename( ic->irc, u->nick, newnick );
+ /* u->nick will be freed halfway the process, so it can't be
+ passed as an argument. */
+ orig_nick = g_strdup( u->nick );
+ user_rename( ic->irc, orig_nick, newnick );
+ g_free( orig_nick );
}
}
diff --git a/user.c b/user.c
index 232e3a58..26676dd4 100644
--- a/user.c
+++ b/user.c
@@ -160,6 +160,7 @@ user_t *user_findhandle( struct im_connection *ic, char *handle )
return NULL;
}
+/* DO NOT PASS u->nick FOR oldnick !!! */
void user_rename( irc_t *irc, char *oldnick, char *newnick )
{
user_t *u = user_find( irc, oldnick );