pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40267?usp=email )
Change subject: cnlink: Cleanup talloc tree ...................................................................... cnlink: Cleanup talloc tree Change-Id: I90c22f2a2932ede7103c66f2263e72ac2fdae497 --- M src/osmo-hnbgw/cnlink.c 1 file changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/67/40267/1 diff --git a/src/osmo-hnbgw/cnlink.c b/src/osmo-hnbgw/cnlink.c index 18ffbd4..85d211a 100644 --- a/src/osmo-hnbgw/cnlink.c +++ b/src/osmo-hnbgw/cnlink.c @@ -163,12 +163,10 @@ struct hnbgw_cnlink *hnbgw_cnlink_alloc(struct hnbgw_cnpool *cnpool, int nr) { - struct osmo_fsm_inst *fi; struct hnbgw_cnlink *cnlink; const struct rate_ctr_group_desc *ctrg_desc; OSMO_ASSERT(cnpool); - char *name = talloc_asprintf(OTC_SELECT, "%s-%d", cnpool->peer_name, nr); switch (cnpool->domain) { case DOMAIN_CS: @@ -181,28 +179,25 @@ OSMO_ASSERT(0); } - - fi = osmo_fsm_inst_alloc(&cnlink_fsm, g_hnbgw, NULL, LOGL_DEBUG, name); - OSMO_ASSERT(fi); - cnlink = talloc_zero(g_hnbgw, struct hnbgw_cnlink); - fi->priv = cnlink; - + cnlink = talloc_zero(cnpool, struct hnbgw_cnlink); + OSMO_ASSERT(cnlink); *cnlink = (struct hnbgw_cnlink){ - .name = name, .pool = cnpool, - .fi = fi, .nr = nr, .vty = { /* VTY config defaults for the new cnlink */ .nri_ranges = osmo_nri_ranges_alloc(cnlink), }, .allow_attach = true, - .ctrs = rate_ctr_group_alloc(g_hnbgw, ctrg_desc, nr), + .ctrs = rate_ctr_group_alloc(cnlink, ctrg_desc, nr), }; - talloc_steal(cnlink, name); + cnlink->name = talloc_asprintf(cnlink, "%s-%d", cnpool->peer_name, nr); INIT_LLIST_HEAD(&cnlink->map_list); INIT_LLIST_HEAD(&cnlink->paging); + cnlink->fi = osmo_fsm_inst_alloc(&cnlink_fsm, cnlink, cnlink, LOGL_DEBUG, cnlink->name); + OSMO_ASSERT(cnlink->fi); + llist_add_tail(&cnlink->entry, &cnpool->cnlinks); LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "allocated\n"); @@ -229,9 +224,14 @@ { if (!cnlink) return; - osmo_fsm_inst_term(cnlink->fi, OSMO_FSM_TERM_REQUEST, NULL); + if (cnlink->hnbgw_sccp_user) hnbgw_cnlink_drop_sccp(cnlink); + + osmo_fsm_inst_term(cnlink->fi, OSMO_FSM_TERM_REQUEST, NULL); + cnlink->fi = NULL; + rate_ctr_group_free(cnlink->ctrs); + llist_del(&cnlink->entry); talloc_free(cnlink); } -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/40267?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I90c22f2a2932ede7103c66f2263e72ac2fdae497 Gerrit-Change-Number: 40267 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de>