From: Scott Griepentrog Date: Fri, 6 Feb 2015 21:26:10 +0000 (+0000) Subject: config hooks: correct ref leaks X-Git-Tag: 11.17.0-rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2394edcc32d9d64b80a9fac1e698f9ee52980723;p=thirdparty%2Fasterisk.git config hooks: correct ref leaks This small patch fixes a ref leak when adding a config hook and cleans up the container on shutdown. Review: https://reviewboard.asterisk.org/r/4407 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431582 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/config.c b/main/config.c index da974d9fb5..8f886e0792 100644 --- a/main/config.c +++ b/main/config.c @@ -3360,6 +3360,9 @@ static void config_shutdown(void) AST_LIST_UNLOCK(&cfmtime_head); ast_cli_unregister_multiple(cli_config, ARRAY_LEN(cli_config)); + + ao2_cleanup(cfg_hooks); + cfg_hooks = NULL; } int register_config_cli(void) @@ -3448,5 +3451,6 @@ int ast_config_hook_register(const char *name, hook->module = ast_strdup(module); ao2_link(cfg_hooks, hook); + ao2_ref(hook, -1); return 0; }