diff mbox series

[BlueZ,v4,2/2] src/shared/micp.c :MICP-MICS implementation memory leak fix

Message ID 20231005121544.306495-3-mahesh.talewad@nxp.com
State New
Headers show
Series MICP-MICS implementation's memory fix and Unit Test case's fix | expand

Commit Message

Mahesh Talewad Oct. 5, 2023, 12:15 p.m. UTC
- Fixed memory leak issue
---
 src/shared/micp.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/micp.c b/src/shared/micp.c
index 90d05b301..b82bd92de 100644
--- a/src/shared/micp.c
+++ b/src/shared/micp.c
@@ -138,6 +138,7 @@  void bt_micp_detach(struct bt_micp *micp)
 	if (!queue_remove(sessions, micp))
 		return;
 
+	bt_gatt_client_idle_unregister(micp->client, micp->idle_id);
 	bt_gatt_client_unref(micp->client);
 	micp->client = NULL;
 
@@ -175,6 +176,7 @@  static void micp_free(void *data)
 
 	micp_db_free(micp->rdb);
 
+	queue_destroy(micp->notify, free);
 	queue_destroy(micp->pending, NULL);
 	queue_destroy(micp->ready_cbs, micp_ready_free);
 
@@ -594,6 +596,7 @@  struct bt_micp *bt_micp_new(struct gatt_db *ldb, struct gatt_db *rdb)
 	micp->ldb = mdb;
 	micp->pending = queue_new();
 	micp->ready_cbs = queue_new();
+	micp->notify = queue_new();
 
 	if (!rdb)
 		goto done;