diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-06-26 19:39:35 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2009-06-26 19:39:35 +0200 |
commit | 966636f39f17e5d42e7918a2055d400c791671b4 (patch) | |
tree | f7bc3c7ac76e2c63ad4a1f5190ed218ab53c2c6b /openbsc/src/msgb.c | |
parent | f16571635a9d81893cb7bcc3d12dbf6639f3b3df (diff) |
use named variant when allocating msgb's
when we generate a talloc report (SIGUSR1), we can now see which system
allocated a given msgb, this helps memory leak debugging
Diffstat (limited to 'openbsc/src/msgb.c')
-rw-r--r-- | openbsc/src/msgb.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c index 8bdc9aa70..ae1334614 100644 --- a/openbsc/src/msgb.c +++ b/openbsc/src/msgb.c @@ -29,18 +29,17 @@ static void *tall_msgb_ctx; -struct msgb *msgb_alloc(u_int16_t size) +struct msgb *msgb_alloc(u_int16_t size, const char *name) { 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); + msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name); if (!msg) return NULL; - memset(msg, 0, sizeof(*msg)+size); msg->data_len = size; msg->len = 0; |