[Bluetooth] Bugfix: prevent memory leak 81/244481/2
authorPawel Wasowski <p.wasowski2@samsung.com>
Wed, 16 Sep 2020 14:11:26 +0000 (16:11 +0200)
committerPiotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 21 Sep 2020 07:56:05 +0000 (09:56 +0200)
commitc204750493cfed551a9344ad84e5cf006046b516
treef60fca50becfc3f515bfe723c9ded8da1685b865
parentc74b60a827bdf2a295ff88c7811d106ef62f3a39
[Bluetooth] Bugfix: prevent memory leak

In the previous implementation if a service was successfully created,
but its registration failed, the resources associated with its handle
were not released.
Such a situation has occurred when Bluetooth was disabled and
BluetoothGATTServer::registerService() was called.
This commit adds the missing line that destroys the handle.

[Verification] The code compiles.
Tested in chrome console - server is successfully created and reports
errors in case of disabled bluetooth adapter. No crash or other issues observed.

Change-Id: I85741e51638abd6b5443d7f7ce5d84e9279fc498
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
src/bluetooth/bluetooth_gatt_server.cc