[asterisk-commits] branch group/asterisk-xmpp r26174 - /team/group/asterisk-xmpp/res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 9 09:26:07 MST 2006


Author: russell
Date: Tue May  9 11:26:06 2006
New Revision: 26174

URL: http://svn.digium.com/view/asterisk?rev=26174&view=rev
Log:
- don't set a local variable to NULL at the end of a function, as it has no effect
- fix a memory leak in aji_buddy_destroy where the resources for the buddy would
  not actually be freed

Modified:
    team/group/asterisk-xmpp/res/res_jabber.c

Modified: team/group/asterisk-xmpp/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/group/asterisk-xmpp/res/res_jabber.c?rev=26174&r1=26173&r2=26174&view=diff
==============================================================================
--- team/group/asterisk-xmpp/res/res_jabber.c (original)
+++ team/group/asterisk-xmpp/res/res_jabber.c Tue May  9 11:26:06 2006
@@ -152,9 +152,7 @@
 {
 	ASTOBJ_CONTAINER_DESTROYALL(&obj->buddies, aji_buddy_destroy);
 	ASTOBJ_CONTAINER_DESTROY(&obj->buddies);
-
 	free(obj);
-	obj = NULL;
 }
 
 /*!
@@ -164,14 +162,14 @@
  */
 static void aji_buddy_destroy(struct aji_buddy *obj)
 {
-	struct aji_resource *tmp = NULL;
-	while (tmp) {
-		tmp = obj->resources;
+	struct aji_resource *tmp;
+
+	while ((tmp = obj->resources)) {
 		obj->resources = obj->resources->next;
 		free(tmp);
 	}
+
 	free(obj);
-	obj = NULL;
 }
 
 static struct aji_resource *aji_find_resource(struct aji_buddy *buddy, char *rname)



More information about the asterisk-commits mailing list