diff libpurple/protocols/simple/simple.c @ 24967:adf153852bcf

propagate from branch 'im.pidgin.pidgin' (head df86c6f1de324e87828356aa8d5c369abd533b58) to branch 'im.pidgin.pidgin.vv' (head 5bf87e309f2fee61842cccf4992de4866349570c)
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 24 Nov 2008 10:59:08 +0000
parents e22bcca9f2b2 7d07bb66f70b
children 25e2ab1fff1d
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c	Mon Nov 24 10:43:38 2008 +0000
+++ b/libpurple/protocols/simple/simple.c	Mon Nov 24 10:59:08 2008 +0000
@@ -1228,11 +1228,14 @@
 				if (purple_str_has_prefix(ssparts[i], "terminated"))
 				{
 					purple_debug_info("simple", "Subscription expired!");
-					g_free(b->dialog->ourtag);
-					g_free(b->dialog->theirtag);
-					g_free(b->dialog->callid);
-					g_free(b->dialog);
-					b->dialog = NULL;
+					if (b->dialog)
+					{
+						g_free(b->dialog->ourtag);
+						g_free(b->dialog->theirtag);
+						g_free(b->dialog->callid);
+						g_free(b->dialog);
+						b->dialog = NULL;
+					}
 
 					purple_prpl_got_user_status(sip->account, from, "offline", NULL);
 					break;
@@ -1627,6 +1630,13 @@
 		cur[0] = '\0';
 		purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf);
 		msg = sipmsg_parse_header(conn->inbuf);
+
+		if(!msg) {
+			/* Should we re-use this error message (from lower in the function)? */
+			purple_debug_misc("simple", "received a incomplete sip msg: %s\n", conn->inbuf);
+			return;
+		}
+
 		cur[0] = '\r';
 		cur += 2;
 		restlen = conn->inbufused - (cur - conn->inbuf);