[asterisk-commits] rmudgett: branch 12 r398562 - /branches/12/main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 6 15:02:17 CDT 2013


Author: rmudgett
Date: Fri Sep  6 15:02:15 2013
New Revision: 398562

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398562
Log:
cdr: Fix some ref leaks.

* Added missing unregister of the cdr container in cdr_engine_shutdown().

* Fixed ref leak in off nominal path of cdr_object_alloc().

* Removed some unnecessary NULL checks in cdr_object_dtor().

Modified:
    branches/12/main/cdr.c

Modified: branches/12/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/cdr.c?view=diff&rev=398562&r1=398561&r2=398562
==============================================================================
--- branches/12/main/cdr.c (original)
+++ branches/12/main/cdr.c Fri Sep  6 15:02:15 2013
@@ -811,10 +811,6 @@
 	struct cdr_object *cdr = obj;
 	struct ast_var_t *it_var;
 
-	if (!cdr) {
-		return;
-	}
-
 	ao2_cleanup(cdr->party_a.snapshot);
 	ao2_cleanup(cdr->party_b.snapshot);
 	while ((it_var = AST_LIST_REMOVE_HEAD(&cdr->party_a.variables, entries))) {
@@ -825,9 +821,7 @@
 	}
 	ast_string_field_free_memory(cdr);
 
-	if (cdr->next) {
-		ao2_cleanup(cdr->next);
-	}
+	ao2_cleanup(cdr->next);
 }
 
 /*!
@@ -850,6 +844,7 @@
 	}
 	cdr->last = cdr;
 	if (ast_string_field_init(cdr, 64)) {
+		ao2_cleanup(cdr);
 		return NULL;
 	}
 	ast_string_field_set(cdr, name, chan->name);
@@ -3985,7 +3980,9 @@
 	aco_info_destroy(&cfg_info);
 	ao2_global_obj_release(module_configs);
 
+	ao2_container_unregister("cdrs_by_channel");
 	ao2_ref(active_cdrs_by_channel, -1);
+	active_cdrs_by_channel = NULL;
 }
 
 static void cdr_enable_batch_mode(struct ast_cdr_config *config)




More information about the asterisk-commits mailing list