[MERGED] libosmo-netif[master]: osmo_stream_{cli, srv}_destroy: fix mem leak: empty msgb queue

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Nov 20 16:23:59 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: osmo_stream_{cli,srv}_destroy: fix mem leak: empty msgb queue
......................................................................


osmo_stream_{cli,srv}_destroy: fix mem leak: empty msgb queue

On destroying a client or server stream, deallocate any msgbs that are still
pending in the queue.

In libosmo-sccp, the ss7_test.c in test_as(), messages are queued and were,
before this, left floating after the stream was destroyed, causing a sanitizer
memory leak. This patch fixes the leak.

Depends: Ia291832ca445d4071f0ed9a01730d945ff691cf7 (libosmocore)
Change-Id: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639
---
M src/stream.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/stream.c b/src/stream.c
index d9c3f62..8a1be38 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -430,6 +430,7 @@
 {
 	osmo_stream_cli_close(cli);
 	osmo_timer_del(&cli->timer);
+	msgb_queue_free(&cli->tx_queue);
 	talloc_free(cli);
 }
 
@@ -924,6 +925,7 @@
 	osmo_fd_unregister(&conn->ofd);
 	if (conn->closed_cb)
 		conn->closed_cb(conn);
+	msgb_queue_free(&conn->tx_queue);
 	talloc_free(conn);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/4878
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639
Gerrit-PatchSet: 4
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list