summaryrefslogtreecommitdiff
path: root/main/named_acl.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-06-25 01:12:58 +0000
committerMatthew Jordan <mjordan@digium.com>2013-06-25 01:12:58 +0000
commit13b470d704285b596caab33039fdf1b063bbcf9d (patch)
tree74dae44213d76a78b1ae30da11bb43e92e9f8ead /main/named_acl.c
parent91217ac3c1fd73efe13407a013260ac7cf937b7b (diff)
Fix memory/ref counting leaks in a variety of locations
This patch fixes the following memory leaks: * http.c: The structure containing the addresses to bind to was not being deallocated when no longer used * named_acl.c: The global configuration information was not disposed of * config_options.c: An invalid read was occurring for certain option types. * res_calendar.c: The loaded calendars on module unload were not being properly disposed of. * chan_motif.c: The format capabilities needed to be disposed of on module unload. In addition, this now specifies the default options for the maxpayloads and maxicecandidates in such a way that it doesn't cause the invalid read in config_options.c to occur. (issue ASTERISK-21906) Reported by: John Hardin patches: http.patch uploaded by jhardin (license 6512) named_acl.patch uploaded by jhardin (license 6512) config_options.patch uploaded by jhardin (license 6512) res_calendar.patch uploaded by jhardin (license 6512) chan_motif.patch uploaded by jhardin (license 6512) ........ Merged revisions 392810 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392812 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/named_acl.c')
-rw-r--r--main/named_acl.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/main/named_acl.c b/main/named_acl.c
index d374e3a71..a93f78954 100644
--- a/main/named_acl.c
+++ b/main/named_acl.c
@@ -360,21 +360,6 @@ struct ast_ha *ast_named_acl_find(const char *name, int *is_realtime, int *is_un
/*! \brief Message type for named ACL changes */
STASIS_MESSAGE_TYPE_DEFN(ast_named_acl_change_type);
-static void acl_stasis_cleanup(void)
-{
- STASIS_MESSAGE_TYPE_CLEANUP(ast_named_acl_change_type);
-}
-
-/*!
- * \internal
- * \brief Initialize Named ACL related stasis topics/messages
- */
-static void ast_acl_stasis_init(void)
-{
- ast_register_cleanup(acl_stasis_cleanup);
- STASIS_MESSAGE_TYPE_INIT(ast_named_acl_change_type);
-}
-
/*!
* \internal
* \brief Sends a stasis message corresponding to a given named ACL that has changed or
@@ -580,16 +565,25 @@ static struct ast_cli_entry cli_named_acl[] = {
AST_CLI_DEFINE(handle_show_named_acl_cmd, "Show a named ACL or list all named ACLs"),
};
+static void named_acl_cleanup(void)
+{
+ STASIS_MESSAGE_TYPE_CLEANUP(ast_named_acl_change_type);
+ aco_info_destroy(&cfg_info);
+ ao2_global_obj_release(globals);
+}
+
int ast_named_acl_init()
{
ast_cli_register_multiple(cli_named_acl, ARRAY_LEN(cli_named_acl));
+ STASIS_MESSAGE_TYPE_INIT(ast_named_acl_change_type);
+
+ ast_register_cleanup(named_acl_cleanup);
+
if (aco_info_init(&cfg_info)) {
return 0;
}
- ast_acl_stasis_init();
-
/* Register the per level options. */
aco_option_register(&cfg_info, "permit", ACO_EXACT, named_acl_types, NULL, OPT_ACL_T, 1, FLDSET(struct named_acl, ha));
aco_option_register(&cfg_info, "deny", ACO_EXACT, named_acl_types, NULL, OPT_ACL_T, 0, FLDSET(struct named_acl, ha));