mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
Fix crash when getting CEL config
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
10
main/cel.c
10
main/cel.c
@@ -1512,7 +1512,7 @@ struct ast_cel_general_config *ast_cel_get_config(void)
|
|||||||
{
|
{
|
||||||
RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
||||||
|
|
||||||
if (!mod_cfg->general) {
|
if (!mod_cfg || !mod_cfg->general) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1525,9 +1525,11 @@ void ast_cel_set_config(struct ast_cel_general_config *config)
|
|||||||
RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
|
||||||
RAII_VAR(struct ast_cel_general_config *, cleanup_config, mod_cfg->general, ao2_cleanup);
|
RAII_VAR(struct ast_cel_general_config *, cleanup_config, mod_cfg->general, ao2_cleanup);
|
||||||
|
|
||||||
mod_cfg->general = config;
|
if (mod_cfg) {
|
||||||
if (mod_cfg->general) {
|
mod_cfg->general = config;
|
||||||
ao2_ref(mod_cfg->general, +1);
|
if (mod_cfg->general) {
|
||||||
|
ao2_ref(mod_cfg->general, +1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user