Bluetooth: hci_sync: fix memory leak in hci_update_adv_data()
authorZhengchao Shao <shaozhengchao@huawei.com>
Mon, 9 Jan 2023 01:26:51 +0000 (09:26 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 17 Jan 2023 23:59:02 +0000 (15:59 -0800)
commit1ed8b37cbaf14574c779064ef1372af62e8ba6aa
tree31458c1795f42861c16d4371552332b7ac55c9b4
parent272970be3dabd24cbe50e393ffee8f04aec3b9a8
Bluetooth: hci_sync: fix memory leak in hci_update_adv_data()

When hci_cmd_sync_queue() failed in hci_update_adv_data(), inst_ptr is
not freed, which will cause memory leak, convert to use ERR_PTR/PTR_ERR
to pass the instance to callback so no memory needs to be allocated.

Fixes: 651cd3d65b0f ("Bluetooth: convert hci_update_adv_data to hci_sync")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/hci_sync.c