From d5e6c2374b3c20ed5bc2eaf12c0038633f8b27c8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 5 Aug 2010 10:08:36 +0000 Subject: nat: Use the mgcp_config_alloc to have defaults initialized Initialize the net_base properly and benefit from future config changes but also reset certain defauls that we do not want at the nat. --- openbsc/src/nat/bsc_mgcp_utils.c | 8 ++++++++ openbsc/src/nat/bsc_nat.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c index e8f7e2461..f03834264 100644 --- a/openbsc/src/nat/bsc_mgcp_utils.c +++ b/openbsc/src/nat/bsc_mgcp_utils.c @@ -533,11 +533,19 @@ int bsc_mgcp_nat_init(struct bsc_nat *nat) } /* some more MGCP config handling */ + if (nat->mgcp_cfg->audio_name) + talloc_free(nat->mgcp_cfg->audio_name); + nat->mgcp_cfg->audio_name = NULL; + nat->mgcp_cfg->audio_payload = -1; nat->mgcp_cfg->data = nat; nat->mgcp_cfg->policy_cb = bsc_mgcp_policy_cb; nat->mgcp_cfg->force_realloc = 1; + + if (nat->mgcp_cfg->bts_ip) + talloc_free(nat->mgcp_cfg->bts_ip); nat->mgcp_cfg->bts_ip = ""; + nat->bsc_endpoints = talloc_zero_array(nat, struct bsc_endpoint, nat->mgcp_cfg->number_endpoints + 1); diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index e5c2c39ac..9cf3ba32f 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -1120,7 +1120,7 @@ int main(int argc, char** argv) return -4; } - nat->mgcp_cfg = talloc_zero(nat, struct mgcp_config); + nat->mgcp_cfg = mgcp_config_alloc(); if (!nat->mgcp_cfg) { fprintf(stderr, "Failed to allocate MGCP cfg.\n"); return -5; -- cgit v1.2.3