[asterisk-commits] kmoore: branch mjordan/pjsip-cli r404451 - /team/mjordan/pjsip-cli/res/res_pj...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 20 14:24:40 CST 2013
Author: kmoore
Date: Fri Dec 20 14:24:38 2013
New Revision: 404451
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404451
Log:
Check for more allocation failures
Modified:
team/mjordan/pjsip-cli/res/res_pjsip/location.c
Modified: team/mjordan/pjsip-cli/res/res_pjsip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/pjsip-cli/res/res_pjsip/location.c?view=diff&rev=404451&r1=404450&r2=404451
==============================================================================
--- team/mjordan/pjsip-cli/res/res_pjsip/location.c (original)
+++ team/mjordan/pjsip-cli/res/res_pjsip/location.c Fri Dec 20 14:24:38 2013
@@ -397,16 +397,26 @@
{
RAII_VAR(struct ao2_container *, parent_container, NULL, ao2_cleanup);
RAII_VAR(struct ao2_container *, s_parent_container, NULL, ao2_cleanup);
- RAII_VAR(struct ao2_container *, child_container, NULL, ao2_cleanup);
-
- parent_container = ast_sorcery_retrieve_by_fields(sip_sorcery, "aor",
- AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
+ struct ao2_container *child_container;
+
+ parent_container = ast_sorcery_retrieve_by_fields(sip_sorcery, "aor",
+ AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
+ if (!parent_container) {
+ return NULL;
+ }
s_parent_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, &ast_sorcery_object_id_compare, NULL);
+ if (!s_parent_container) {
+ return NULL;
+ }
+
ao2_container_dup(s_parent_container, parent_container, OBJ_ORDER_ASCENDING);
child_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
- ao2_ref(child_container, +1);
+ if (!child_container) {
+ return NULL;
+ }
+
ao2_callback(s_parent_container, OBJ_NODATA, gather_aor_channels, child_container);
return child_container;
@@ -539,14 +549,14 @@
return 0;
}
-static struct ast_sip_cli_formatter_entry cli_contact_formatter = {
+static struct ast_sip_cli_formatter_entry cli_contact_formatter = {
.name = "contact",
.print_header = cli_print_contact_header,
.print_body = cli_print_contact_body,
.get_container = cli_get_contact_container,
};
-static struct ast_sip_cli_formatter_entry cli_aor_formatter = {
+static struct ast_sip_cli_formatter_entry cli_aor_formatter = {
.name = "aor",
.print_header = cli_print_aor_header,
.print_body = cli_print_aor_body,
More information about the asterisk-commits
mailing list