summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-07-11 05:03:47 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2020-01-08 21:23:37 +0100
commita3cf1ff110569251ceaaab2b2ed267e7db2f8674 (patch)
treec94b61cc50890e2a5992a4ca169ca900b107d623
parenta468af2c64a85978a1d5e394539e900e3b3a2050 (diff)
name xua_msg by code path to debug xua msg alloc leaks
-rw-r--r--include/osmocom/sigtran/xua_msg.h3
-rw-r--r--src/xua_msg.c3
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;