diff --git a/channels/chan_motif.c b/channels/chan_motif.c index 92710ac2ee..86b31e0fb7 100644 --- a/channels/chan_motif.c +++ b/channels/chan_motif.c @@ -2555,9 +2555,9 @@ static int load_module(void) aco_option_register_custom(&cfg_info, "connection", ACO_EXACT, endpoint_options, NULL, custom_connection_handler, 0); aco_option_register_custom(&cfg_info, "transport", ACO_EXACT, endpoint_options, NULL, custom_transport_handler, 0); aco_option_register(&cfg_info, "maxicecandidates", ACO_EXACT, endpoint_options, DEFAULT_MAX_ICE_CANDIDATES, OPT_UINT_T, PARSE_DEFAULT, - FLDSET(struct jingle_endpoint, maxicecandidates)); + FLDSET(struct jingle_endpoint, maxicecandidates), DEFAULT_MAX_ICE_CANDIDATES); aco_option_register(&cfg_info, "maxpayloads", ACO_EXACT, endpoint_options, DEFAULT_MAX_PAYLOADS, OPT_UINT_T, PARSE_DEFAULT, - FLDSET(struct jingle_endpoint, maxpayloads)); + FLDSET(struct jingle_endpoint, maxpayloads), DEFAULT_MAX_PAYLOADS); ast_format_cap_add_all_by_type(jingle_tech.capabilities, AST_FORMAT_TYPE_AUDIO); @@ -2608,6 +2608,8 @@ static int reload(void) static int unload_module(void) { ast_channel_unregister(&jingle_tech); + ast_format_cap_destroy(jingle_tech.capabilities); + jingle_tech.capabilities = NULL; ast_rtp_glue_unregister(&jingle_rtp_glue); ast_sched_context_destroy(sched); aco_info_destroy(&cfg_info); diff --git a/main/config_options.c b/main/config_options.c index 5e76a7a7be..e2547e698f 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -153,14 +153,15 @@ static int link_option_to_types(struct aco_type **types, struct aco_option *opt) return -1; } if (!ao2_link(type->internal->opts, opt)) { - while (--idx) { + do { ao2_unlink(types[idx]->internal->opts, opt); - } + } while (--idx); return -1; } - /* The container should hold the only ref to opt */ - ao2_ref(opt, -1); } + /* The container(s) should hold the only ref to opt */ + ao2_ref(opt, -1); + return 0; } diff --git a/main/http.c b/main/http.c index a41e1b4a49..565c41f8e0 100644 --- a/main/http.c +++ b/main/http.c @@ -1024,7 +1024,7 @@ static int __ast_http_load(int reload) struct http_uri_redirect *redirect; struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; uint32_t bindport = DEFAULT_PORT; - struct ast_sockaddr *addrs = NULL; + RAII_VAR(struct ast_sockaddr *, addrs, NULL, ast_free); int num_addrs = 0; int http_tls_was_enabled = 0; diff --git a/main/named_acl.c b/main/named_acl.c index 59e1d1f94b..2ec2d7045d 100644 --- a/main/named_acl.c +++ b/main/named_acl.c @@ -555,10 +555,18 @@ 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) +{ + 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)); + ast_register_atexit(named_acl_cleanup); + if (aco_info_init(&cfg_info)) { return 0; } diff --git a/res/res_calendar.c b/res/res_calendar.c index 13c95d9a9d..b60d8234d9 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -1810,6 +1810,8 @@ static int unload_module(void) /* Remove all calendars */ ao2_callback(calendars, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL); + ao2_cleanup(calendars); + calendars = NULL; ast_mutex_lock(&refreshlock); module_unloading = 1;