Fix crash issue when destroying notify io 92/311192/2 accepted/tizen/7.0/unified/20240521.012533
authorWootak Jung <wootak.jung@samsung.com>
Thu, 16 May 2024 02:00:26 +0000 (11:00 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 16 May 2024 02:49:57 +0000 (11:49 +0900)
0  0x0000005592375a48 in notify_io_destroy (data=0x55a1388d20) at src/gatt-client.c:1692 --> bluez (rpm)
1  0x0000005592373420 in sock_io_destroy (io=0x55a137df70) at src/gatt-client.c:1195 --> bluez (rpm)
2  0x0000005592377900 in characteristic_free (data=0x55a1384570) at src/gatt-client.c:2015 --> bluez (rpm)

Revert "Allow AcquireNotify without CCC"

This reverts commit 4c19ca3b4973feea3e663e3bbd7483d71cb9dabb.

Change-Id: If23642af016fe507c1b14a7b26acb515faf5b894

src/gatt-client.c

index 50f775a4219d0711bf7a5bd8516349b6036b43e0..d7c02fe4689ddbb854bc0f674b28094a1eb87712 100644 (file)
@@ -1727,12 +1727,6 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        if (!client)
                return btd_error_failed(msg, "Failed allocate notify session");
 
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-       chrc->notify_io = new0(struct sock_io, 1);
-       chrc->notify_io->data = client;
-       chrc->notify_io->msg = dbus_message_ref(msg);
-       chrc->notify_io->destroy = notify_io_destroy;
-#endif
        client->notify_id = bt_gatt_client_register_notify(gatt,
                                                chrc->value_handle,
                                                register_notify_io_cb,
@@ -1740,11 +1734,6 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
                                                client, NULL);
        if (!client->notify_id) {
                notify_client_unref(client);
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-               dbus_message_unref(chrc->notify_io->msg);
-               g_free(chrc->notify_io);
-               chrc->notify_io = NULL;
-#endif
                return btd_error_failed(msg, "Failed to subscribe");
        }
 
@@ -1754,12 +1743,10 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        DBG("Added client to notify_clients. length: %d", queue_length(chrc->notify_clients));
 #endif
 
-#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
        chrc->notify_io = new0(struct sock_io, 1);
        chrc->notify_io->data = client;
        chrc->notify_io->msg = dbus_message_ref(msg);
        chrc->notify_io->destroy = notify_io_destroy;
-#endif
 
        return NULL;
 }