From 941e317c97e8366429917ae970c31e56f233bfc3 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 22 Sep 2022 21:16:56 +0200 Subject: [PATCH] osmux: Get rid of static NULL talloc context struct osmux_handle, which is shared by several rtp_conn, is attached to the trunk object, since the socket also attaches to it. Related: SYS#5987 Change-Id: If4980424cdb8e3dc26a23e9ee419c0a38912f38f --- src/libosmo-mgcp/mgcp_osmux.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 0109342ae..4ad3f10a9 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -41,8 +41,6 @@ struct osmux_handle { int refcnt; }; -static void *osmux; - /* Deliver OSMUX batch to the remote end */ static void osmux_deliver_cb(struct msgb *batch_msg, void *data) { @@ -125,9 +123,10 @@ static struct osmux_handle * osmux_handle_alloc(struct mgcp_conn_rtp *conn, const struct osmo_sockaddr *rem_addr) { struct osmux_handle *h; - struct mgcp_config *cfg = conn->conn->endp->trunk->cfg; + struct mgcp_trunk *trunk = conn->conn->endp->trunk; + struct mgcp_config *cfg = trunk->cfg; - h = talloc_zero(osmux, struct osmux_handle); + h = talloc_zero(trunk, struct osmux_handle); if (!h) return NULL; h->rem_addr = *rem_addr; @@ -506,7 +505,7 @@ int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn, return -1; } - conn->osmux.out = osmux_xfrm_output_alloc(osmux); + conn->osmux.out = osmux_xfrm_output_alloc(conn->conn); osmux_xfrm_output_set_rtp_ssrc(conn->osmux.out, (conn->osmux.cid * rtp_ssrc_winlen) + (random() % rtp_ssrc_winlen));