mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 20:08:17 +00:00
Fixed segfault when no misdn.conf exists, reported by Igor Neves, thanks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@47359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4121,8 +4121,11 @@ int load_module(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
misdn_cfg_init(max_ports);
|
||||
if (misdn_cfg_init(max_ports)<0) {
|
||||
ast_log(LOG_ERROR, "Unable to initialize mISDN Config System\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_config_initialized=1;
|
||||
|
||||
misdn_debug = (int *)malloc(sizeof(int) * (max_ports+1));
|
||||
|
||||
@@ -85,7 +85,7 @@ enum misdn_cfg_method {
|
||||
};
|
||||
|
||||
/* you must call misdn_cfg_init before any other function of this header file */
|
||||
void misdn_cfg_init(int max_ports);
|
||||
int misdn_cfg_init(int max_ports);
|
||||
void misdn_cfg_reload(void);
|
||||
void misdn_cfg_destroy(void);
|
||||
|
||||
|
||||
@@ -727,7 +727,7 @@ void misdn_cfg_destroy (void)
|
||||
ast_mutex_destroy(&config_mutex);
|
||||
}
|
||||
|
||||
void misdn_cfg_init (int this_max_ports)
|
||||
int misdn_cfg_init (int this_max_ports)
|
||||
{
|
||||
char config[] = "misdn.conf";
|
||||
char *cat, *p;
|
||||
@@ -737,7 +737,7 @@ void misdn_cfg_init (int this_max_ports)
|
||||
|
||||
if (!(cfg = AST_LOAD_CFG(config))) {
|
||||
ast_log(LOG_WARNING,"no misdn.conf ?\n");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
misdn_cfg_lock();
|
||||
@@ -783,4 +783,6 @@ void misdn_cfg_init (int this_max_ports)
|
||||
|
||||
misdn_cfg_unlock();
|
||||
AST_DESTROY_CFG(cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user