From 966636f39f17e5d42e7918a2055d400c791671b4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 26 Jun 2009 19:39:35 +0200 Subject: 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 --- openbsc/src/msgb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'openbsc/src/msgb.c') 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; -- cgit v1.2.3