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
diff --git a/openbsc/src/msgb.c b/openbsc/src/msgb.c
index 8bdc9aa..ae13346 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;