diff libpurple/protocols/msn/servconn.c @ 24389:ae66b7b3086a

Make the two "read_cb()" functions more similar, and fix a rare memleak in httpconn by adding a call to g_free(header). Only happens if the server sends us abnormal data.
author Mark Doliner <mark@kingant.net>
date Sat, 15 Nov 2008 09:44:05 +0000
parents 5cedf11b8e77
children d72c185d0be3
line wrap: on
line diff
--- a/libpurple/protocols/msn/servconn.c	Sat Nov 15 07:43:48 2008 +0000
+++ b/libpurple/protocols/msn/servconn.c	Sat Nov 15 09:44:05 2008 +0000
@@ -375,15 +375,14 @@
 	servconn = data;
 	session = servconn->session;
 
-	len = read(servconn->fd, buf, sizeof(buf) - 1);
 	if (servconn->type == MSN_SERVCONN_NS)
-		servconn->session->account->gc->last_received = time(NULL);
+		session->account->gc->last_received = time(NULL);
 
-	if (len < 0 && errno == EAGAIN) {
+	len = read(servconn->fd, buf, sizeof(buf) - 1);
+	if (len < 0 && errno == EAGAIN)
 		return;
-
-	} else if (len <= 0) {
-		purple_debug_error("msn", "servconn %03d read error,"
+	if (len <= 0) {
+		purple_debug_error("msn", "servconn %03d read error, "
 			"len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n",
 			servconn->num, len, errno, g_strerror(errno));
 		msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);