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) {
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) {
/* 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);
};
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;
}
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)