diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-04 07:08:33 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-08-04 07:08:33 +0800 |
commit | f41617bb11ef051b34590bb2ea34ad3a272086c1 (patch) | |
tree | 1fc82965faf0bd7ac44cbdd3a9834939dc3fb1c1 /src/mgcp_ss7.c | |
parent | fde865f18de656f00dc4d155bc1a19401322dce2 (diff) |
mgcp: Allocate the mgcp config earlier..
Diffstat (limited to 'src/mgcp_ss7.c')
-rw-r--r-- | src/mgcp_ss7.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index f9e5682..901de94 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -68,6 +68,7 @@ static int endp_dscp = 0; #define TO_MGW_PORT(no) (no-1) #define FROM_MGW_PORT(no) (no+1) +static struct mgcp_config *g_cfg; static struct mgcp_ss7 *s_ss7; struct mgcp_ss7_endpoint { @@ -608,12 +609,7 @@ struct mgcp_ss7 *mgcp_ss7_init(int endpoints, const char *local_ip, const char * return NULL; write_queue_init(&conf->mgcp_fd, 30); - conf->cfg = mgcp_config_alloc(); - if (!conf->cfg) { - LOGP(DMGCP, LOGL_ERROR, "Failed to allocate memory.\n"); - talloc_free(conf); - return NULL; - } + conf->cfg = g_cfg; /* take over the ownership */ talloc_steal(conf, conf->cfg); @@ -786,6 +782,13 @@ int main(int argc, char **argv) signal(SIGPIPE, SIG_IGN); mgcp_mgw_vty_init(); + + g_cfg = mgcp_config_alloc(); + if (!g_cfg) { + LOGP(DMGCP, LOGL_ERROR, "Failed to allocate mgcp config.\n"); + return -1; + } + if (vty_read_config_file(config_file, NULL) < 0) { fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file); return -1; |