diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-06-12 08:58:20 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-06-12 08:58:20 +0200 | 
| commit | 5a5c926ec0dffa4b28895929c092089c2a9b9d9f (patch) | |
| tree | a7d5b5549d2a83011f98fb149e508220cd3bd7a9 | |
| parent | fb62f81f947c74e274b05e32d2e88e3a4d7e2613 (diff) | |
Fixed a (very rare, AFAIK) NULL-pointer dereference.
| -rw-r--r-- | protocols/msn/msn.c | 51 | 
1 files changed, 27 insertions, 24 deletions
| diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 3c7064f8..bac9c427 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -63,33 +63,38 @@ static void msn_close( struct gaim_connection *gc )  	struct msn_data *md = gc->proto_data;  	GSList *l; -	if( md->fd >= 0 ) -		closesocket( md->fd ); -	 -	if( md->handler ) -	{ -		if( md->handler->rxq ) g_free( md->handler->rxq ); -		if( md->handler->cmd_text ) g_free( md->handler->cmd_text ); -		g_free( md->handler ); -	} -	 -	while( md->switchboards ) -		msn_sb_destroy( md->switchboards->data ); -	 -	if( md->msgq ) +	if( md )  	{ -		struct msn_message *m; +		if( md->fd >= 0 ) +			closesocket( md->fd ); -		for( l = md->msgq; l; l = l->next ) +		if( md->handler )  		{ -			m = l->data; +			if( md->handler->rxq ) g_free( md->handler->rxq ); +			if( md->handler->cmd_text ) g_free( md->handler->cmd_text ); +			g_free( md->handler ); +		} -			serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who ); -			g_free( m->who ); -			g_free( m->text ); -			g_free( m ); +		while( md->switchboards ) +			msn_sb_destroy( md->switchboards->data ); +		 +		if( md->msgq ) +		{ +			struct msn_message *m; +			 +			for( l = md->msgq; l; l = l->next ) +			{ +				m = l->data; +			 +				serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who ); +				g_free( m->who ); +				g_free( m->text ); +				g_free( m ); +			} +			g_slist_free( md->msgq );  		} -		g_slist_free( md->msgq ); +		 +		g_free( md );  	}  	for( l = gc->permit; l; l = l->next ) @@ -100,8 +105,6 @@ static void msn_close( struct gaim_connection *gc )  		g_free( l->data );  	g_slist_free( gc->deny ); -	g_free( md ); -	  	msn_connections = g_slist_remove( msn_connections, gc );  } | 
