mesh: Fix race condition memory leak
authorBrian Gix <brian.gix@intel.com>
Wed, 19 May 2021 19:00:45 +0000 (12:00 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
This is a minor fix of a memory leak triggered on process exit if
proceess has been killed right after requesting an outbound
advertisement be sent.  It is harmless, but will cause an occasional
static analysis failure.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/mesh-io-generic.c

index 3112a86..7f82774 100644 (file)
@@ -497,7 +497,9 @@ static bool dev_destroy(struct mesh_io *io)
        bt_hci_unref(pvt->hci);
        l_timeout_remove(pvt->tx_timeout);
        l_queue_destroy(pvt->rx_regs, l_free);
+       l_queue_remove_if(pvt->tx_pkts, simple_match, pvt->tx);
        l_queue_destroy(pvt->tx_pkts, l_free);
+       l_free(pvt->tx);
        l_free(pvt);
        io->pvt = NULL;