Fix issue where the previous trigger_bond_info was deleted when requesting bond 55/309255/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 8 Apr 2024 04:40:59 +0000 (13:40 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 8 Apr 2024 04:43:33 +0000 (13:43 +0900)
Change-Id: Ifd6a8522a1bd57571933ecdba36f7249b376645e
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/device/bt-service-core-device.c

index 15d1827..b155b57 100644 (file)
@@ -1820,8 +1820,10 @@ int _bt_bond_device(bluetooth_device_address_t *device_address,
 #endif
        result = __bt_device_handle_bond_state();
 
-       if (result != BLUETOOTH_ERROR_NONE)
+       if (result != BLUETOOTH_ERROR_NONE) {
+               __bt_free_bond_info(BT_DEVICE_BOND_INFO);
                goto fail;
+       }
 
        return result;
 
@@ -1832,7 +1834,6 @@ fail:
 
        g_array_append_vals(*out_param1, &dev_info,
                        sizeof(bluetooth_device_info_t));
-       __bt_free_bond_info(BT_DEVICE_BOND_INFO);
 
        return result;
 }