From a3cf1ff110569251ceaaab2b2ed267e7db2f8674 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 11 Jul 2018 05:03:47 +0200 Subject: name xua_msg by code path to debug xua msg alloc leaks Change-Id: I59e5a5379a72a846f35962a1325d6d6a57af8345 --- include/osmocom/sigtran/xua_msg.h | 3 ++- src/xua_msg.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/osmocom/sigtran/xua_msg.h b/include/osmocom/sigtran/xua_msg.h index e912e02..9c3c49c 100644 --- a/include/osmocom/sigtran/xua_msg.h +++ b/include/osmocom/sigtran/xua_msg.h @@ -71,7 +71,8 @@ extern const struct xua_dialect xua_dialect_m3ua; void osmo_xua_msg_tall_ctx_init(void *ctx); -struct xua_msg *xua_msg_alloc(void); +#define xua_msg_alloc() _xua_msg_alloc(__FILE__, __LINE__) +struct xua_msg *_xua_msg_alloc(const char *file, int line); void xua_msg_free(struct xua_msg *msg); int xua_msg_add_data(struct xua_msg *msg, uint16_t tag, uint16_t len, uint8_t *dat); diff --git a/src/xua_msg.c b/src/xua_msg.c index 91adcf1..21c48a3 100644 --- a/src/xua_msg.c +++ b/src/xua_msg.c @@ -41,13 +41,14 @@ void osmo_xua_msg_tall_ctx_init(void *ctx) tall_xua = talloc_named_const(ctx, 0, "xua_msg"); } -struct xua_msg *xua_msg_alloc(void) +struct xua_msg *_xua_msg_alloc(const char *file, int line) { struct xua_msg *msg; msg = talloc_zero(tall_xua, struct xua_msg); if (!msg) return NULL; + talloc_set_name(msg, "xua_msg(%s:%d)", file, line); INIT_LLIST_HEAD(&msg->headers); return msg; -- cgit v1.2.3