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/include/openbsc/msgb.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'openbsc/include/openbsc/msgb.h') diff --git a/openbsc/include/openbsc/msgb.h b/openbsc/include/openbsc/msgb.h index 2c31d1587..5ecac459b 100644 --- a/openbsc/include/openbsc/msgb.h +++ b/openbsc/include/openbsc/msgb.h @@ -47,7 +47,7 @@ struct msgb { unsigned char _data[0]; }; -extern struct msgb *msgb_alloc(u_int16_t size); +extern struct msgb *msgb_alloc(u_int16_t size, const char *name); extern void msgb_free(struct msgb *m); extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); extern struct msgb *msgb_dequeue(struct llist_head *queue); @@ -100,9 +100,10 @@ static inline void msgb_reserve(struct msgb *msg, int len) msg->tail += len; } -static inline struct msgb *msgb_alloc_headroom(int size, int headroom) +static inline struct msgb *msgb_alloc_headroom(int size, int headroom, + const char *name) { - struct msgb *msg = msgb_alloc(size); + struct msgb *msg = msgb_alloc(size, name); if (msg) msgb_reserve(msg, headroom); return msg; -- cgit v1.2.3