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/msgb.c | |
parent | 879dc971ff61c8405a9bdb505b24ec66296ecb4f (diff) |
introduce talloc all over OpenBSC
Diffstat (limited to 'openbsc/src/msgb.c')
-rw-r--r-- | openbsc/src/msgb.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c index ce390e84a..8bdc9aa70 100644 --- a/openbsc/src/msgb.c +++ b/openbsc/src/msgb.c @@ -24,10 +24,19 @@ #include <sys/types.h> #include <openbsc/msgb.h> +#include <openbsc/gsm_data.h> +#include <openbsc/talloc.h> + +static void *tall_msgb_ctx; struct msgb *msgb_alloc(u_int16_t size) { - struct msgb *msg = malloc(sizeof(*msg) + size); + struct msgb *msg; + + if (!tall_msgb_ctx) + tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 1, "msgb"); + + msg = talloc_size(tall_msgb_ctx, sizeof(*msg) + size); if (!msg) return NULL; @@ -48,7 +57,7 @@ struct msgb *msgb_alloc(u_int16_t size) void msgb_free(struct msgb *m) { - free(m); + talloc_free(m); } void msgb_enqueue(struct llist_head *queue, struct msgb *msg) |