Fix Crash issue 37/313737/2 accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_x tizen accepted/tizen/unified/20240703.100018 accepted/tizen/unified/dev/20240704.065633 accepted/tizen/unified/x/20240704.023001
authorAnuj Jain <anuj01.jain@samsung.com>
Mon, 17 Jun 2024 05:57:22 +0000 (11:27 +0530)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 1 Jul 2024 09:50:32 +0000 (18:50 +0900)
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 44dbbe3..ca92f26 100644 (file)
@@ -1469,8 +1469,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)