From 7ca1a0da04f6363324274aa7065a12f613f6cee0 Mon Sep 17 00:00:00 2001 From: Scott Griepentrog Date: Fri, 6 Feb 2015 21:26:46 +0000 Subject: various: cleanup issues found during leak hunt In this collection of small patches to prevent Valgrind errors are: fixes for reference leaks in config hooks, evaluating a parameter beyond bounds, and accessing a structure after a lock where it could have been already free'd. Review: https://reviewboard.asterisk.org/r/4407/ ........ Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431584 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/config.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main/config.c') diff --git a/main/config.c b/main/config.c index 0aa6bbefc..7e5141398 100644 --- a/main/config.c +++ b/main/config.c @@ -3821,6 +3821,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) @@ -3909,5 +3912,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; } -- cgit v1.2.3