mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
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(). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@398562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
11
main/cdr.c
11
main/cdr.c
@@ -811,10 +811,6 @@ static void cdr_object_dtor(void *obj)
|
||||
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 @@ static void cdr_object_dtor(void *obj)
|
||||
}
|
||||
ast_string_field_free_memory(cdr);
|
||||
|
||||
if (cdr->next) {
|
||||
ao2_cleanup(cdr->next);
|
||||
}
|
||||
ao2_cleanup(cdr->next);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -850,6 +844,7 @@ static struct cdr_object *cdr_object_alloc(struct ast_channel_snapshot *chan)
|
||||
}
|
||||
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 @@ static void cdr_engine_shutdown(void)
|
||||
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)
|
||||
|
Reference in New Issue
Block a user