diff options
author | Inga Stotland <inga.stotland@gmail.com> | 2023-03-19 22:06:18 -0700 |
---|---|---|
committer | Brian Gix <brian.gix@gmail.com> | 2023-03-20 12:18:37 -0700 |
commit | 4a3f465a55c9e2159d363a5419f3a5dbb965036d (patch) | |
tree | 69080a113a7aacb8f0a8a2c151ddec1b27e17341 /mesh | |
parent | 551a0c80ab33332920b966dbd7e6761a1b640ed6 (diff) | |
download | bluez-4a3f465a55c9e2159d363a5419f3a5dbb965036d.tar.gz |
mesh: On exit free timer for filtering duplicates
This frees resources associated with duplicate filter timer
when destroying management IO.
Diffstat (limited to 'mesh')
-rw-r--r-- | mesh/mesh-io-mgmt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesh/mesh-io-mgmt.c b/mesh/mesh-io-mgmt.c index f1385edcc..5f51f3a1f 100644 --- a/mesh/mesh-io-mgmt.c +++ b/mesh/mesh-io-mgmt.c @@ -35,6 +35,7 @@ struct mesh_io_private { struct mesh_io *io; void *user_data; struct l_timeout *tx_timeout; + struct l_timeout *dup_timeout; struct l_queue *dup_filters; struct l_queue *rx_regs; struct l_queue *tx_pkts; @@ -146,6 +147,7 @@ static void filter_timeout(struct l_timeout *timeout, void *user_data) done: l_timeout_remove(timeout); + pvt->dup_timeout = NULL; } /* Ignore consequtive duplicate advertisements within timeout period */ @@ -179,7 +181,8 @@ static bool filter_dups(const uint8_t *addr, const uint8_t *adv, /* Start filter expiration timer */ if (!l_queue_length(pvt->dup_filters)) - l_timeout_create(1, filter_timeout, NULL, NULL); + pvt->dup_timeout = l_timeout_create(1, filter_timeout, NULL, + NULL); l_queue_push_head(pvt->dup_filters, filter); instant_delta = instant - filter->instant; @@ -474,6 +477,7 @@ static bool dev_destroy(struct mesh_io *io) mesh_mgmt_unregister(pvt->rx_id); mesh_mgmt_unregister(pvt->tx_id); l_timeout_remove(pvt->tx_timeout); + l_timeout_remove(pvt->dup_timeout); l_queue_destroy(pvt->dup_filters, l_free); l_queue_destroy(pvt->rx_regs, free_rx_reg); l_queue_destroy(pvt->tx_pkts, l_free); |