aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-17 03:29:51 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-11-20 16:23:59 +0000
commitc72be77aa330c968f9f1d624e38141b3c2e24323 (patch)
tree9bbcdf265555ab6e33896547c25613cd97945a83
parentb6e8d39417b217e9bbf396d50c3ef2a91a6c4054 (diff)
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
-rw-r--r--src/stream.c2
1 files changed, 2 insertions, 0 deletions
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);
}