From 90e2c751e97bfbe7cc18e040aaf60dc5236d8d7b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 22 Mar 2016 19:26:52 +0100 Subject: iu.c: introduce talloc_iu_ctx Introduce talloc_iu_ctx, setup during iu_init() as child of the talloc_ctx passed in by the caller. Allocate ue_conn_ctx from talloc_iu_ctx, used to be from NULL. Allocate osmo_sua_user and talloc_asn1_ctx from talloc_iu_ctx, used to be from the ctx passed in by iu_init() caller. --- openbsc/src/libiu/iu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index f93fc0b38..044b831f2 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -30,6 +30,8 @@ #include +void *talloc_iu_ctx; + int asn1_xer_print = 1; void *talloc_asn1_ctx; @@ -40,7 +42,7 @@ static LLIST_HEAD(ue_conn_ctx_list); struct ue_conn_ctx *ue_conn_ctx_alloc(struct osmo_sua_link *link, uint32_t conn_id) { - struct ue_conn_ctx *ctx = talloc_zero(NULL, struct ue_conn_ctx); + struct ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ue_conn_ctx); ctx->link = link; ctx->conn_id = conn_id; @@ -491,12 +493,13 @@ int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port, iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb) { struct osmo_sua_user *user; - talloc_asn1_ctx = talloc_named_const(ctx, 1, "asn1"); + talloc_iu_ctx = talloc_named_const(ctx, 1, "iu"); + talloc_asn1_ctx = talloc_named_const(talloc_iu_ctx, 1, "asn1"); global_iu_recv_cb = iu_recv_cb; global_iu_event_cb = iu_event_cb; osmo_sua_set_log_area(DSUA); - user = osmo_sua_user_create(ctx, sccp_sap_up, ctx); + user = osmo_sua_user_create(talloc_iu_ctx, sccp_sap_up, talloc_iu_ctx); return osmo_sua_server_listen(user, listen_addr, listen_port); } -- cgit v1.2.3