aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_04_08.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-06-20 22:36:41 +0200
committerHarald Welte <laforge@gnumonks.org>2009-06-20 22:36:41 +0200
commit2cf161be08795be4a074ba2b50fdd81ad1f4c35e (patch)
tree3d1be58cd835c41e74f2a0d6a293085da5389777 /openbsc/src/gsm_04_08.c
parent879dc971ff61c8405a9bdb505b24ec66296ecb4f (diff)
introduce talloc all over OpenBSC
Diffstat (limited to 'openbsc/src/gsm_04_08.c')
-rw-r--r--openbsc/src/gsm_04_08.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 117fb1224..49234f8d8 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -44,6 +44,7 @@
#include <openbsc/signal.h>
#include <openbsc/trau_frame.h>
#include <openbsc/trau_mux.h>
+#include <openbsc/talloc.h>
#define GSM48_ALLOC_SIZE 1024
#define GSM48_ALLOC_HEADROOM 128
@@ -52,6 +53,9 @@
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
+static void *tall_locop_ctx;
+static void *tall_trans_ctx;
+
static const struct tlv_definition rsl_att_tlvdef = {
.def = {
[GSM48_IE_MOBILE_ID] = { TLV_TYPE_TLV },
@@ -337,7 +341,7 @@ static void release_loc_updating_req(struct gsm_lchan *lchan)
return;
bsc_del_timer(&lchan->loc_operation->updating_timer);
- free(lchan->loc_operation);
+ talloc_free(lchan->loc_operation);
lchan->loc_operation = 0;
put_lchan(lchan);
}
@@ -347,8 +351,11 @@ static void allocate_loc_updating_req(struct gsm_lchan *lchan)
use_lchan(lchan);
release_loc_updating_req(lchan);
- lchan->loc_operation = (struct gsm_loc_updating_operation *)
- malloc(sizeof(*lchan->loc_operation));
+ if (!tall_locop_ctx)
+ tall_locop_ctx = talloc_named_const(tall_bsc_ctx, 1,
+ "loc_updating_oper");
+ lchan->loc_operation = talloc(tall_locop_ctx,
+ struct gsm_loc_updating_operation);
memset(lchan->loc_operation, 0, sizeof(*lchan->loc_operation));
}
@@ -1911,7 +1918,7 @@ void free_trans(struct gsm_trans *trans)
llist_del(&trans->entry);
- free(trans);
+ talloc_free(trans);
}
static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg);
@@ -3420,7 +3427,7 @@ int mncc_send(struct gsm_network *net, int msg_type, void *arg)
GSM48_CC_CAUSE_DEST_OOO);
}
/* Create transaction */
- if (!(trans = calloc(1, sizeof(struct gsm_trans)))) {
+ if (!(trans = talloc(tall_trans_ctx, struct gsm_trans))) {
DEBUGP(DCC, "No memory for trans.\n");
subscr_put(subscr);
/* Ressource unavailable */
@@ -3626,7 +3633,7 @@ static int gsm0408_rcv_cc(struct msgb *msg)
DEBUGP(DCC, "Unknown transaction ID %02x, "
"creating new trans.\n", transaction_id);
/* Create transaction */
- if (!(trans = calloc(1, sizeof(struct gsm_trans)))) {
+ if (!(trans = talloc(tall_trans_ctx, struct gsm_trans))) {
DEBUGP(DCC, "No memory for trans.\n");
rc = gsm48_tx_simple(msg->lchan,
GSM48_PDISC_CC | transaction_id,