diff options
-rw-r--r-- | openbsc/include/openbsc/mgcp.h | 1 | ||||
-rw-r--r-- | openbsc/src/libmgcp/mgcp_protocol.c | 6 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 6 |
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); } |