aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-12-21 12:43:21 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2018-01-30 18:59:29 +0100
commit5f017ff0d2e2e6304233fe499dc53bb47516b4f4 (patch)
tree7c18e8b96315c367b2b5371f841ea42ea6a5e216
parentc458f43bf5ed39067e203ab198320756d023b9f9 (diff)
osmo-bsc_nat: Free mgcp_configs on shutdown
-rw-r--r--openbsc/include/openbsc/mgcp.h1
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c6
3 files changed, 11 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 3445777c5..f98020fa0 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -247,6 +247,7 @@ struct mgcp_config {
/* config management */
struct mgcp_config *mgcp_config_alloc(void);
+void mgcp_config_free(struct mgcp_config *cfg);
struct mgcp_config *mgcp_config_by_num(struct llist_head *configs, int index);
int mgcp_parse_config(const char *config_file, struct llist_head **cfg,
enum mgcp_role role);
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 765e461a7..eddfb5811 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1222,6 +1222,12 @@ struct mgcp_config *mgcp_config_alloc(void)
return cfg;
}
+void mgcp_config_free(struct mgcp_config *cfg)
+{
+ llist_del(&cfg->entry);
+ talloc_free(cfg);
+}
+
struct mgcp_trunk_config *mgcp_trunk_alloc(struct mgcp_config *cfg, int nr)
{
struct mgcp_trunk_config *trunk;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 6d46e4f3f..5bc3a22f2 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -106,6 +106,7 @@ void bsc_nat_free(struct bsc_nat *nat)
struct bsc_config *bcfg, *btmp;
struct msc_config *mcfg, *mtmp;
struct bsc_msg_acc_lst *lst, *tmp_lst;
+ struct mgcp_config *mgcp_cfg, *mgcp_tmp;
llist_for_each_entry_safe(mcfg, mtmp, &nat->msc_configs, entry)
msc_config_free(mcfg);
@@ -126,8 +127,9 @@ void bsc_nat_free(struct bsc_nat *nat)
osmo_counter_free(nat->stats.bsc.auth_fail);
osmo_counter_free(nat->stats.msc.reconn);
osmo_counter_free(nat->stats.ussd.reconn);
-#warning "Free each mgcp"
-// talloc_free(nat->mgcp_cfgs);
+
+ llist_for_each_entry_safe(mgcp_cfg, mgcp_tmp, nat->mgcp_cfgs, entry)
+ mgcp_config_free(mgcp_cfg);
talloc_free(nat);
}