diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2017-05-05 10:34:17 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-05-05 10:34:17 -0500 |
commit | 250fee82aaa02c7d8be4d21cba75bf5460b32af9 (patch) | |
tree | 6550642ed309eac6d940a4eccd3888538a0a94f7 | |
parent | ce1985b09932e99361f5ee36c4c859d5b30edb93 (diff) | |
parent | bed6c0d04b71ce404adc9a75835a5a20cbc143bd (diff) |
Merge "app_confbridge: Fix reference to cfg in menu_template_handler" into 13
-rw-r--r-- | apps/confbridge/conf_config_parser.c | 4 | ||||
-rw-r--r-- | main/config_options.c | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c index 96ed8920c..2de1ec238 100644 --- a/apps/confbridge/conf_config_parser.c +++ b/apps/confbridge/conf_config_parser.c @@ -2022,7 +2022,7 @@ static int conf_menu_profile_copy(struct conf_menu *dst, struct conf_menu *src) static int menu_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj) { struct conf_menu *dst_menu = obj; - struct confbridge_cfg *cfg = aco_pending_config(&cfg_info); + RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup); RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup); if (!cfg) { @@ -2057,6 +2057,7 @@ static int verify_default_profiles(void) RAII_VAR(struct user_profile *, user_profile, NULL, ao2_cleanup); RAII_VAR(struct bridge_profile *, bridge_profile, NULL, ao2_cleanup); RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup); + /* We can only be called as a result of an aco_process_config so this is safe */ struct confbridge_cfg *cfg = aco_pending_config(&cfg_info); if (!cfg) { @@ -2154,6 +2155,7 @@ int conf_load_config(void) /* Menu options */ aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0); + /* This option should only be used with the CONFBRIDGE dialplan function */ aco_option_register_custom(&cfg_info, "template", ACO_EXACT, menu_types, NULL, menu_template_handler, 0); aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0); diff --git a/main/config_options.c b/main/config_options.c index cc8e218f8..81d0ff9a0 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -588,10 +588,13 @@ enum aco_process_status aco_process_ast_config(struct aco_info *info, struct aco }; ao2_cleanup(info->internal->pending); + info->internal->pending = NULL; return ACO_PROCESS_OK; error: ao2_cleanup(info->internal->pending); + info->internal->pending = NULL; + return ACO_PROCESS_ERROR; } @@ -704,6 +707,8 @@ try_alias: end: ao2_cleanup(info->internal->pending); + info->internal->pending = NULL; + return res; } int aco_process_var(struct aco_type *type, const char *cat, struct ast_variable *var, void *obj) |