diff mbox series

[BlueZ,v3,2/2] shared/uhid: Fix not cleanup input queue on destroy

Message ID 20240813142935.504400-2-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v3,1/2] shared/uhid: Fix registering UHID_START multiple times | expand

Commit Message

Luiz Augusto von Dentz Aug. 13, 2024, 2:29 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The input queue shall be cleanup on bt_uhid_destroy since that shall not
be carried to the next session even if the input node is not destroyed.
---
 src/shared/uhid.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/uhid.c b/src/shared/uhid.c
index 4f149fdb8c4d..98d6198c7d0a 100644
--- a/src/shared/uhid.c
+++ b/src/shared/uhid.c
@@ -504,6 +504,10 @@  int bt_uhid_destroy(struct bt_uhid *uhid, bool force)
 	if (!uhid)
 		return -EINVAL;
 
+	/* Cleanup input queue */
+	queue_destroy(uhid->input, free);
+	uhid->input = NULL;
+
 	/* Force destroy for non-keyboard devices - keyboards are not destroyed
 	 * on disconnect since they can glitch on reconnection losing
 	 * keypresses.