From 911d97a988d5f3d90c4b15c05adc733ada1fb37a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 4 Aug 2011 16:19:54 +0100 Subject: Error handling fixes. Found one double free() bug causing troubles when a buddy_msg() handler takes down the IM connection immediately. --- irc_im.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'irc_im.c') diff --git a/irc_im.c b/irc_im.c index 6add08dd..986693aa 100644 --- a/irc_im.c +++ b/irc_im.c @@ -450,9 +450,13 @@ static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg ) static gboolean bee_irc_user_privmsg_cb( gpointer data, gint fd, b_input_condition cond ) { irc_user_t *iu = data; - char *msg = g_string_free( iu->pastebuf, FALSE ); + char *msg; GSList *l; + msg = g_string_free( iu->pastebuf, FALSE ); + iu->pastebuf = NULL; + iu->pastebuf_timer = 0; + for( l = irc_plugins; l; l = l->next ) { irc_plugin_t *p = l->data; @@ -478,8 +482,6 @@ static gboolean bee_irc_user_privmsg_cb( gpointer data, gint fd, b_input_conditi bee_user_msg( iu->irc->b, iu->bu, msg, 0 ); g_free( msg ); - iu->pastebuf = NULL; - iu->pastebuf_timer = 0; return FALSE; } -- cgit v1.2.3