Fix Crash issue 98/312898/2 accepted/tizen/7.0/unified/20240620.154529
authorAnuj Jain <anuj01.jain@samsung.com>
Mon, 17 Jun 2024 05:57:22 +0000 (11:27 +0530)
committerAnuj Jain <anuj01.jain@samsung.com>
Mon, 17 Jun 2024 09:08:40 +0000 (14:38 +0530)
This patch fixes crash issue occuring due to access of freed
gatt client pointer.

Change-Id: I064ea4bd624373fde9bbb74923eebd2dc1d081d8
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
src/gatt-client.c

index 977926af572fed6d1a137305c1405e35ebb2bf16..d2d6825baf122ab1e7341ca698b3dd86def587a2 100644 (file)
@@ -1446,8 +1446,19 @@ static void notify_client_free(struct notify_client *client)
        g_dbus_remove_watch(btd_get_dbus_connection(), client->watch);
        bt_gatt_client_unregister_notify(client->chrc->service->client->gatt,
                                                        client->notify_id);
+
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       if (client->chrc->notify_io->data == client)
+               client->chrc->notify_io->data = NULL;
+#endif
        free(client->owner);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       client->owner = NULL;
+#endif
        free(client);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       client = NULL;
+#endif
 }
 
 static void notify_client_unref(void *data)