[asterisk-commits] trunk r31298 - /trunk/res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 1 01:22:47 MST 2006


Author: mogorman
Date: Thu Jun  1 03:22:44 2006
New Revision: 31298

URL: http://svn.digium.com/view/asterisk?rev=31298&view=rev
Log:
solves bug where reload deleted things it shouldnt have
and adds check into jabberstatus so it cant segfault.

Modified:
    trunk/res/res_jabber.c

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?rev=31298&r1=31297&r2=31298&view=diff
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Thu Jun  1 03:22:44 2006
@@ -332,7 +332,11 @@
 		ast_log(LOG_WARNING, "Could not find Connection.\n");
 		return -1;
 	}
-
+	
+	if(!&client->buddies) {
+		ast_log(LOG_WARNING, "No buddies for connection.\n");
+		return -1;
+	}
 	ASTOBJ_CONTAINER_TRAVERSE(&client->buddies, 1, {
 		ASTOBJ_RDLOCK(iterator); 
 		if (!strcasecmp(iterator->user, screenname)) {
@@ -2057,6 +2061,7 @@
 		}
 	}
 	ASTOBJ_UNLOCK(buddy);
+	ASTOBJ_UNMARK(buddy);
 	ASTOBJ_CONTAINER_LINK(&client->buddies, buddy);
 	return 0;
 }
@@ -2088,8 +2093,10 @@
 	ASTOBJ_UNLOCK(buddy);
 	if(flag)
 		ASTOBJ_CONTAINER_LINK(&client->buddies, buddy);
-	else
+	else {
+		ASTOBJ_UNMARK(buddy);
 		ASTOBJ_UNREF(buddy, aji_buddy_destroy);
+	}
 	return 1;
 }
 



More information about the asterisk-commits mailing list