add msgb_set_talloc_ctx() to set the talloc context for msgb allocations
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 8665c2b..58976f7 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -193,5 +193,7 @@
 uint8_t *msgb_data(const struct msgb *msg);
 uint16_t msgb_length(const struct msgb *msg);
 
+/* set the talloc context for msgb_alloc[_headroom] */
+void msgb_set_talloc_ctx(void *ctx);
 
 #endif /* _MSGB_H */
diff --git a/src/msgb.c b/src/msgb.c
index d2c167a..f9841ed 100644
--- a/src/msgb.c
+++ b/src/msgb.c
@@ -98,3 +98,8 @@
 {
 	return msg->len;
 }
+
+void msgb_set_talloc_ctx(void *ctx)
+{
+	tall_msgb_ctx = ctx;
+}