diff libpurple/protocols/msn/servconn.c @ 28713:33856dfb5cbf

Donot use a servconn if it's freed. Mark a leak.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 08 Oct 2009 18:14:41 +0000
parents 8e31eec7b621
children 203839bc0f7c
line wrap: on
line diff
--- a/libpurple/protocols/msn/servconn.c	Thu Oct 08 18:12:06 2009 +0000
+++ b/libpurple/protocols/msn/servconn.c	Thu Oct 08 18:14:41 2009 +0000
@@ -440,11 +440,12 @@
 	memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1);
 	servconn->rx_len += len;
 
-	msn_servconn_process_data(servconn);
-	servconn_timeout_renew(servconn);
+	servconn = msn_servconn_process_data(servconn);
+	if (servconn)
+		servconn_timeout_renew(servconn);
 }
 
-void msn_servconn_process_data(MsnServConn *servconn)
+MsnServConn *msn_servconn_process_data(MsnServConn *servconn)
 {
 	char *cur, *end, *old_rx_buf;
 	int cur_len;
@@ -503,10 +504,13 @@
 
 	servconn->processing = FALSE;
 
-	if (servconn->wasted)
+	if (servconn->wasted) {
 		msn_servconn_destroy(servconn);
+		servconn = NULL;
+	}
 
 	g_free(old_rx_buf);
+	return servconn;
 }
 
 #if 0