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
This commit is contained in:
Neels Hofmeyr 2023-02-19 01:43:44 +01:00 committed by neels
parent 1d129ae24b
commit 4a2f3e9490
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}