From 2cf161be08795be4a074ba2b50fdd81ad1f4c35e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 20 Jun 2009 22:36:41 +0200 Subject: introduce talloc all over OpenBSC --- openbsc/src/trau_mux.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'openbsc/src/trau_mux.c') diff --git a/openbsc/src/trau_mux.c b/openbsc/src/trau_mux.c index 196d15fa7..7615b6294 100644 --- a/openbsc/src/trau_mux.c +++ b/openbsc/src/trau_mux.c @@ -30,6 +30,7 @@ #include #include #include +#include struct map_entry { struct llist_head list; @@ -46,11 +47,19 @@ struct upqueue_entry { static LLIST_HEAD(ss_map); static LLIST_HEAD(ss_upqueue); +static void *tall_map_ctx, *tall_upq_ctx; + /* map one particular subslot to another subslot */ int trau_mux_map(const struct gsm_e1_subslot *src, const struct gsm_e1_subslot *dst) { - struct map_entry *me = malloc(sizeof(*me)); + struct map_entry *me; + + if (!tall_map_ctx) + tall_map_ctx = talloc_named_const(tall_bsc_ctx, 1, + "trau_map_entry"); + + me = talloc(tall_map_ctx, struct map_entry); if (!me) return -ENOMEM; @@ -189,8 +198,13 @@ int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref) { struct gsm_e1_subslot *src_ss; - struct upqueue_entry *ue = malloc(sizeof(*ue)); + struct upqueue_entry *ue; + + if (!tall_upq_ctx) + tall_upq_ctx = talloc_named_const(tall_bsc_ctx, 1, + "trau_upq_entry"); + ue = talloc(tall_upq_ctx, struct upqueue_entry); if (!ue) return -ENOMEM; -- cgit v1.2.3