aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2008-04-05 00:13:07 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2008-04-05 00:13:07 +0100
commit8dbe021fab08902eb202da8da26d183cb0832fca (patch)
tree7c0796e493313a2268f8f746cf8c6da6fa551c06 /root_commands.c
parent883a398f059f98cb31da77dd6e632e4152dcf87e (diff)
Don't pass an account_t pointer directly to query_add() since query_del()
wants to free it! Passing an indirect pointer instead.
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/root_commands.c b/root_commands.c
index 9a60b5af..2bccc465 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -205,22 +205,24 @@ static void cmd_drop( irc_t *irc, char **cmd )
void cmd_account_del_yes( gpointer w, void *data )
{
- account_t *a = data;
- irc_t *irc = a->irc;
+ account_t **aptr = data;
+ irc_t *irc = (*aptr)->irc;
- if( a->ic )
+ if( (*aptr)->ic )
{
irc_usermsg( irc, "Account is still logged in, can't delete" );
}
else
{
- account_del( irc, a );
+ account_del( irc, (*aptr) );
irc_usermsg( irc, "Account deleted" );
}
+ g_free( aptr );
}
void cmd_account_del_no( gpointer w, void *data )
{
+ g_free( data );
}
static void cmd_account( irc_t *irc, char **cmd )
@@ -277,14 +279,18 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
+ account_t **aptr;
char *msg;
+ aptr = g_malloc( sizeof( aptr ) );
+ *aptr = a;
+
msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will "
"also forget all your saved nicknames. If you want "
"to change your username/password, use the `account "
"set' command. Are you sure you want to delete this "
"account?", a->prpl->name, a->user );
- query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a );
+ query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, aptr );
g_free( msg );
}
}