Fix a variety of ref counting issues

This patch resolves a number of ref leaks that occur primarily on Asterisk
shutdown.  It adds a variety of shutdown routines to core portions of
Asterisk such that they can reclaim resources allocate duringd initialization.

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

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

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

Merged revisions 374196 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2012-10-02 01:47:16 +00:00
parent 4e228fce03
commit a094707d51
24 changed files with 366 additions and 24 deletions

View File

@@ -3314,6 +3314,14 @@ AST_TEST_DEFINE(test_data_get)
#endif
/*! \internal \brief Clean up resources on Asterisk shutdown */
static void data_shutdown(void)
{
ast_manager_unregister("DataGet");
ao2_t_ref(root_data.container, -1, "Unref root_data.container in data_shutdown");
ast_rwlock_destroy(&root_data.lock);
}
int ast_data_init(void)
{
int res = 0;
@@ -3333,5 +3341,7 @@ int ast_data_init(void)
AST_TEST_REGISTER(test_data_get);
#endif
ast_register_atexit(data_shutdown);
return res;
}