gatt-client: Fix crash issue when gatt notification occurs 84/316784/1
authorWootak Jung <wootak.jung@samsung.com>
Fri, 27 Sep 2024 01:12:20 +0000 (10:12 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Tue, 17 Dec 2024 02:08:40 +0000 (11:08 +0900)
Change-Id: I2e88a7568565639b1b4709e138931b3decc92c5a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/gatt-client.c

index 68d86c9400066e61abde3a144e5132a672c96802..3706729573b76db7fe31f498f82f5a85dbe7081f 100644 (file)
@@ -1664,7 +1664,12 @@ static void notify_io_cb(uint16_t value_handle, const uint8_t *value,
 {
        struct msghdr msg;
        struct iovec iov;
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
        struct notify_client *client = user_data;
+#else
+       struct async_dbus_op *op = user_data;
+       struct notify_client *client = op->data;
+#endif
        struct characteristic *chrc = client->chrc;
        int err;
 
@@ -1783,6 +1788,8 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
                dbus_message_unref(chrc->notify_io->msg);
                g_free(chrc->notify_io);
                chrc->notify_io = NULL;
+
+               async_dbus_op_free(op);
 #endif
                return btd_error_failed(msg, "Failed to subscribe");
        }
@@ -1794,6 +1801,8 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        chrc->notify_io->data = client;
        chrc->notify_io->msg = dbus_message_ref(msg);
        chrc->notify_io->destroy = notify_io_destroy;
+
+       async_dbus_op_free(op);
 #endif
 
        return NULL;