From 4194646aeed17dcdf1d89f9726cb9d8d2238909f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 20 May 2022 16:17:11 -0700 Subject: [PATCH] monitor/att: Fix not removing read from queue The code was using queue_find instead of queue_remove_if so follow up read wouldn't match the attribute properly. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- monitor/att.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor/att.c b/monitor/att.c index 9323796..61eaa9c 100644 --- a/monitor/att.c +++ b/monitor/att.c @@ -541,7 +541,7 @@ static void att_read_req(const struct l2cap_frame *frame) return; handler = get_handler(attr); - if (!handler) + if (!handler || !handler->read) return; conn = packet_get_conn_data(frame->handle); @@ -580,11 +580,13 @@ static void att_read_rsp(const struct l2cap_frame *frame) data = conn->data; - read = queue_find(data->reads, match_read_frame, frame); + read = queue_remove_if(data->reads, match_read_frame, (void *)frame); if (!read) return; read->func(frame); + + free(read); } static void att_read_blob_req(const struct l2cap_frame *frame) -- 2.7.4