summaryrefslogtreecommitdiff
path: root/main/udptl.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-10-02 01:47:16 +0000
committerMatthew Jordan <mjordan@digium.com>2012-10-02 01:47:16 +0000
commita094707d5156a005fb6e9277bd4a14f9d7e7ab1c (patch)
tree26a15c7ef864995e2f2d89d09294024bad0145cb /main/udptl.c
parent4e228fce0382550136e5c34cb4d9fd400b8d4ad3 (diff)
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
Diffstat (limited to 'main/udptl.c')
-rw-r--r--main/udptl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/udptl.c b/main/udptl.c
index 3d110e21b..83dcd3d90 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -1462,6 +1462,13 @@ int ast_udptl_reload(void)
return 0;
}
+/*! \internal \brief Clean up resources on Asterisk shutdown */
+static void udptl_shutdown(void)
+{
+ ao2_t_global_obj_release(globals, "Unref udptl global container in shutdown");
+ aco_info_destroy(&cfg_info);
+}
+
void ast_udptl_init(void)
{
if (aco_info_init(&cfg_info)) {
@@ -1496,4 +1503,6 @@ void ast_udptl_init(void)
ast_cli_register_multiple(cli_udptl, ARRAY_LEN(cli_udptl));
__ast_udptl_reload(0);
+
+ ast_register_atexit(udptl_shutdown);
}