gatt-client: Fix crash issue when gatt notification occurs 18/318318/1 accepted/tizen/7.0/unified/20241002.160649
authorWootak Jung <wootak.jung@samsung.com>
Fri, 27 Sep 2024 01:12:20 +0000 (10:12 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 27 Sep 2024 01:14:19 +0000 (10:14 +0900)
Change-Id: I2e88a7568565639b1b4709e138931b3decc92c5a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/gatt-client.c

index 790882cc5f77e72e80dd008629be427db4c6fc60..6d8025316b09b61b3011f51521384c5380f5df8d 100644 (file)
@@ -1649,7 +1649,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;
 
@@ -1779,6 +1784,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;