summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.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 /res/res_musiconhold.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 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 3c61b26fe..057c41326 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1828,7 +1828,11 @@ static int load_moh_classes(int reload)
static void ast_moh_destroy(void)
{
ast_verb(2, "Destroying musiconhold processes\n");
- ao2_t_callback(mohclasses, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL, "Destroy callback");
+ if (mohclasses) {
+ ao2_t_callback(mohclasses, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL, "Destroy callback");
+ ao2_ref(mohclasses, -1);
+ mohclasses = NULL;
+ }
}
static char *handle_cli_moh_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)