[svn-commits] irroot: branch irroot/distrotech-customers-10 r342561 - in /team/irroot/distr...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 27 10:07:12 CDT 2011


Author: irroot
Date: Thu Oct 27 10:07:06 2011
New Revision: 342561

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=342561
Log:
Cleanup reference leaks in res_jabber

res_jabber.c had a number of places where astobjs would be referenced and have their
reference counts bumped without having a dereference made before the object lost scope.
This patch adds a number of ASTOBJ_UNREFs to resolve that.

Review: https://reviewboard.asterisk.org/r/1478/
........

Merged revisions 342545 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 342546 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    team/irroot/distrotech-customers-10/   (props changed)
    team/irroot/distrotech-customers-10/res/res_jabber.c

Propchange: team/irroot/distrotech-customers-10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: team/irroot/distrotech-customers-10/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 27 10:07:06 2011
@@ -1,1 +1,1 @@
-/branches/10:1-342536
+/branches/10:1-342560

Modified: team/irroot/distrotech-customers-10/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-10/res/res_jabber.c?view=diff&rev=342561&r1=342560&r2=342561
==============================================================================
--- team/irroot/distrotech-customers-10/res/res_jabber.c (original)
+++ team/irroot/distrotech-customers-10/res/res_jabber.c Thu Oct 27 10:07:06 2011
@@ -2118,6 +2118,7 @@
 	resource = aji_find_resource(buddy, pak->from->resource);
 	if (pak->subtype == IKS_TYPE_ERROR) {
 		ast_log(LOG_WARNING, "Received error from a client, turn on jabber debug!\n");
+		ASTOBJ_UNREF(client, aji_client_destroy);
 		return IKS_FILTER_EAT;
 	}
 	if (pak->subtype == IKS_TYPE_RESULT) {
@@ -3041,6 +3042,7 @@
 			buddy = ast_calloc(1, sizeof(*buddy));
 			if (!buddy) {
 				ast_log(LOG_WARNING, "Out of memory\n");
+				ASTOBJ_UNREF(client, aji_client_destroy);
 				return 0;
 			}
 			ASTOBJ_INIT(buddy);
@@ -3238,6 +3240,7 @@
 	snprintf(newmsgs, sizeof(newmsgs), "%d",
 		ast_event_get_ie_uint(ast_event, AST_EVENT_IE_NEWMSGS));
 	aji_publish_mwi(client, mailbox, context, oldmsgs, newmsgs);
+	ASTOBJ_UNREF(client, aji_client_destroy);
 
 }
 /*!
@@ -3262,6 +3265,7 @@
 	device = ast_event_get_ie_str(ast_event, AST_EVENT_IE_DEVICE);
 	device_state = ast_devstate_str(ast_event_get_ie_uint(ast_event, AST_EVENT_IE_STATE));
 	aji_publish_device_state(client, device, device_state);
+	ASTOBJ_UNREF(client, aji_client_destroy);
 }
 
 /*!
@@ -3515,7 +3519,7 @@
 	int error_num;
 	iks *orig_request;
 	iks *orig_pubsub = iks_find(pak->x, "pubsub");
-	struct aji_client *client = ASTOBJ_REF((struct aji_client *) data);
+	struct aji_client *client;
 	if (!orig_pubsub) {
 		ast_log(LOG_ERROR, "Error isn't a PubSub error, why are we here?\n");
 		return IKS_FILTER_EAT;
@@ -3534,6 +3538,8 @@
 		ast_log(LOG_ERROR, "PubSub Server error, %s\n", error);
 		return IKS_FILTER_EAT;
 	}
+
+	client = ASTOBJ_REF((struct aji_client *) data);
 
 	if (!strcasecmp(iks_name(orig_request), "publish")) {
 		iks *request;
@@ -3550,6 +3556,7 @@
 		iks_insert_node(request, orig_pubsub);
 		ast_aji_send(client, request);
 		iks_delete(request);
+		ASTOBJ_UNREF(client, aji_client_destroy);
 		return IKS_FILTER_EAT;
 	} else if (!strcasecmp(iks_name(orig_request), "subscribe")) {
 		if (ast_test_flag(&pubsubflags, AJI_XEP0248)) {
@@ -3558,7 +3565,7 @@
 			aji_create_pubsub_node(client, NULL, node_name, NULL);
 		}
 	}
-
+	ASTOBJ_UNREF(client, aji_client_destroy);
 	return IKS_FILTER_EAT;
 }
 
@@ -3620,6 +3627,7 @@
 	if (item) {
 		iks_delete(item);
 	}
+	ASTOBJ_UNREF(client, aji_client_destroy);
 	return IKS_FILTER_EAT;
 }
 




More information about the svn-commits mailing list