aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-02-19 01:43:44 +0100
committerneels <nhofmeyr@sysmocom.de>2023-02-20 14:17:00 +0000
commit4a2f3e9490fef23160c9eb800132cd879b92ba43 (patch)
treeddb52b11f48e7196de8061cbad16ef7ddc45edbc
parent1d129ae24bba787a3d811d0cf56f19f3256441cc (diff)
fix msgb leak on OSMO_STREAM_SRV_F_FLUSH_DESTROY
In osmo_stream_srv_send(), call msgb_free() if the msgb is not enqueued. Before this, osmo_stream_srv_send() enqueues a msgb, assuming the queue will free it. But if OSMO_STREAM_SRV_F_FLUSH_DESTROY is set, it just returns and drops the msgb. There is no rc, so the caller cannot know. Change-Id: I994c5e06a9030cfbf4fca8ab42588c61f7121cee
-rw-r--r--src/stream.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 172a299..cbf0b27 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1507,6 +1507,7 @@ void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
OSMO_ASSERT(msg);
if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY) {
LOGP(DLINP, LOGL_DEBUG, "Connection is being flushed and closed; ignoring new outgoing message\n");
+ msgb_free(msg);
return;
}