diff mbox series

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

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

Commit Message

Luiz Augusto von Dentz Aug. 12, 2024, 8:06 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 b0a436d7862b..37574f75888d 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.