neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/31368 )
Change subject: fix msgb leak on OSMO_STREAM_SRV_F_FLUSH_DESTROY ......................................................................
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 --- M src/stream.c 1 file changed, 16 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
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 @@ 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; }