From 0340e5e7cbafe9b6ab6425baa40e3dc945fc99ce Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Thu, 3 Oct 2024 19:14:10 +0100 Subject: [PATCH] Free BT resources acquired during pairing --- src/gui/input/PairingDialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/input/PairingDialog.cpp b/src/gui/input/PairingDialog.cpp index 195bec56..bbd8f38b 100644 --- a/src/gui/input/PairingDialog.cpp +++ b/src/gui/input/PairingDialog.cpp @@ -250,9 +250,11 @@ void PairingDialog::WorkerThread() UpdateCallback(PairingState::SearchFailed); return; } + stdx::scope_exit freeInfo([info]() { bt_free(info);}); //! Open dev to read name const auto hostDesc = hci_open_dev(hostId); + stdx::scope_exit freeDev([hostDesc]() { hci_close_dev(hostDesc);}); char nameBuffer[HCI_MAX_NAME_LENGTH] = {}; // Get device name and compare. Would use product and vendor id from SDP, but many third-party Wiimotes don't store them