From: Jason Parker Date: Tue, 8 Jan 2013 19:06:30 +0000 (+0000) Subject: Cleanup config cache on exit. X-Git-Tag: 10.12.0-digiumphones-rc2~3^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18a946689c4aff5efd2810ef1e323fdd9afd6973;p=thirdparty%2Fasterisk.git Cleanup config cache on exit. (issue ASTERISK-20649) Reported by: Corey Farrell Patches: config-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell ........ Merged revisions 377104 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 377105 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@378658 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/config.c b/main/config.c index e850ee7be3..64af71035c 100644 --- a/main/config.c +++ b/main/config.c @@ -3072,8 +3072,22 @@ int ast_config_hook_register(const char *name, } +static void config_shutdown(void) +{ + struct cache_file_mtime *cfmtime; + + AST_LIST_LOCK(&cfmtime_head); + while ((cfmtime = AST_LIST_REMOVE_HEAD(&cfmtime_head, list))) { + ast_free(cfmtime); + } + AST_LIST_UNLOCK(&cfmtime_head); + + ast_cli_unregister_multiple(cli_config, ARRAY_LEN(cli_config)); +} + int register_config_cli(void) { ast_cli_register_multiple(cli_config, ARRAY_LEN(cli_config)); + ast_register_atexit(config_shutdown); return 0; }