From c72be77aa330c968f9f1d624e38141b3c2e24323 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 17 Nov 2017 03:29:51 +0100 Subject: 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 --- src/stream.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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 @@ void osmo_stream_cli_destroy(struct osmo_stream_cli *cli) { osmo_stream_cli_close(cli); osmo_timer_del(&cli->timer); + msgb_queue_free(&cli->tx_queue); talloc_free(cli); } @@ -924,6 +925,7 @@ void osmo_stream_srv_destroy(struct osmo_stream_srv *conn) osmo_fd_unregister(&conn->ofd); if (conn->closed_cb) conn->closed_cb(conn); + msgb_queue_free(&conn->tx_queue); talloc_free(conn); } -- cgit v1.2.3