[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r342563 - in /team/irroot/dist...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 27 10:14:40 CDT 2011
Author: irroot
Date: Thu Oct 27 10:14:34 2011
New Revision: 342563
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=342563
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
Modified:
team/irroot/distrotech-customers-1.8/ (props changed)
team/irroot/distrotech-customers-1.8/res/res_jabber.c
Propchange: team/irroot/distrotech-customers-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 27 10:14:34 2011
@@ -1,1 +1,1 @@
-/branches/1.8:1-342535
+/branches/1.8:1-342562
Modified: team/irroot/distrotech-customers-1.8/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_jabber.c?view=diff&rev=342563&r1=342562&r2=342563
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_jabber.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_jabber.c Thu Oct 27 10:14:34 2011
@@ -2072,6 +2072,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) {
@@ -2975,6 +2976,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);
@@ -3172,6 +3174,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);
}
/*!
@@ -3196,6 +3199,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);
}
/*!
@@ -3449,7 +3453,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;
@@ -3468,6 +3472,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;
@@ -3484,6 +3490,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)) {
@@ -3492,7 +3499,7 @@
aji_create_pubsub_node(client, NULL, node_name, NULL);
}
}
-
+ ASTOBJ_UNREF(client, aji_client_destroy);
return IKS_FILTER_EAT;
}
@@ -3554,6 +3561,7 @@
if (item) {
iks_delete(item);
}
+ ASTOBJ_UNREF(client, aji_client_destroy);
return IKS_FILTER_EAT;
}
More information about the asterisk-commits
mailing list