From: Kevin Harwell Date: Fri, 30 Aug 2013 18:55:39 +0000 (+0000) Subject: Fix various memory leaks X-Git-Tag: 1.8.24.0-rc1~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e179b6e56e1eab0145e98150fca5dc2164d739fd;p=thirdparty%2Fasterisk.git Fix various memory leaks main/config.c - cleanup cache fie includes res/res_security_log.c - unregister logger level channesl/chan_sip.c - cleanup io context and notify_types (closes issues ASTERISK-22378) Reported by: Corey Farrell Patches: config_shutdown.patch uploaded by coreyfarrell (license 5909) res_security_log.patch uploaded by coreyfarrell (license 5909) chan_sip-1.8.patch uploaded by coreyfarrell (license 5909) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@398102 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 181ce3901f..cd7c70e03c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -32041,7 +32041,12 @@ static int unload_module(void) clear_sip_domains(); ast_free_ha(sip_cfg.contact_ha); + if (sipsock_read_id) { + ast_io_remove(io, sipsock_read_id); + sipsock_read_id = NULL; + } close(sipsock); + io_context_destroy(io); sched_context_destroy(sched); con = ast_context_find(used_context); if (con) { @@ -32055,6 +32060,11 @@ static int unload_module(void) sip_reqresp_parser_exit(); sip_unregister_tests(); + if (notify_types) { + ast_config_destroy(notify_types); + notify_types = NULL; + } + return 0; } diff --git a/main/config.c b/main/config.c index 0ff2d841e9..103a1c9f70 100644 --- a/main/config.c +++ b/main/config.c @@ -2975,6 +2975,10 @@ static void config_shutdown(void) AST_LIST_LOCK(&cfmtime_head); while ((cfmtime = AST_LIST_REMOVE_HEAD(&cfmtime_head, list))) { + struct cache_file_include *cfinclude; + while ((cfinclude = AST_LIST_REMOVE_HEAD(&cfmtime->includes, list))) { + ast_free(cfinclude); + } ast_free(cfmtime); } AST_LIST_UNLOCK(&cfmtime_head); diff --git a/res/res_security_log.c b/res/res_security_log.c index 3e8c48a24e..8611e3f592 100644 --- a/res/res_security_log.c +++ b/res/res_security_log.c @@ -159,6 +159,8 @@ static int unload_module(void) security_event_sub = ast_event_unsubscribe(security_event_sub); } + ast_logger_unregister_level(LOG_SECURITY_NAME); + ast_verb(3, "Security Logging Disabled\n"); return 0;