diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-06-20 22:36:41 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-06-20 22:36:41 +0200 |
commit | 2cf161be08795be4a074ba2b50fdd81ad1f4c35e (patch) | |
tree | 3d1be58cd835c41e74f2a0d6a293085da5389777 /openbsc/src/mncc.c | |
parent | 879dc971ff61c8405a9bdb505b24ec66296ecb4f (diff) |
introduce talloc all over OpenBSC
Diffstat (limited to 'openbsc/src/mncc.c')
-rw-r--r-- | openbsc/src/mncc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/openbsc/src/mncc.c b/openbsc/src/mncc.c index 4282aaf3c..71f2ad501 100644 --- a/openbsc/src/mncc.c +++ b/openbsc/src/mncc.c @@ -27,6 +27,10 @@ #include <openbsc/gsm_04_08.h> #include <openbsc/debug.h> #include <openbsc/mncc.h> +#include <openbsc/talloc.h> +#include <openbsc/gsm_data.h> + +static void *tall_call_ctx; static struct mncc_names { char *name; @@ -103,7 +107,7 @@ static void free_call(struct gsm_call *call) { llist_del(&call->entry); DEBUGP(DMNCC, "(call %x) Call removed.\n", call->callref); - free(call); + talloc_free(call); } @@ -136,8 +140,11 @@ static int mncc_setup_ind(struct gsm_call *call, int msg_type, if (call->remote_ref) return 0; + if (!tall_call_ctx) + tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, + "gsm_call"); /* create remote call */ - if (!(remote = calloc(1, sizeof(struct gsm_call)))) { + if (!(remote = talloc(tall_call_ctx, struct gsm_call))) { memset(&mncc, 0, sizeof(struct gsm_mncc)); mncc.callref = call->callref; mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, @@ -299,8 +306,11 @@ int mncc_recv(struct gsm_network *net, int msg_type, void *arg) if (!call) { if (msg_type != MNCC_SETUP_IND) return 0; /* drop */ + if (!tall_call_ctx) + tall_call_ctx = talloc_named_const(tall_bsc_ctx, 1, + "gsm_call"); /* create call */ - if (!(call = calloc(1, sizeof(struct gsm_call)))) { + if (!(call = talloc(tall_call_ctx, struct gsm_call))) { struct gsm_mncc rel; memset(&rel, 0, sizeof(struct gsm_mncc)); |