nimble/gap: Fix lock issue

Make sure proper cleaning is done when return error on connect and
discovery


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f0518518
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f0518518
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f0518518

Branch: refs/heads/bluetooth5
Commit: f05185188a15af2b5ead490b9d47e40ce6e5731a
Parents: 5c343f5
Author: Łukasz Rymanowski <[email protected]>
Authored: Sat Apr 29 00:50:50 2017 +0200
Committer: Łukasz Rymanowski <[email protected]>
Committed: Thu May 11 14:16:39 2017 +0200

----------------------------------------------------------------------
 net/nimble/host/src/ble_gap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0518518/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index 80bfa7a..122ef75 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2217,7 +2217,7 @@ ble_gap_disc(uint8_t own_addr_type, int32_t duration_ms,
     if (!params.passive) {
         rc = ble_hs_id_use_addr(own_addr_type);
         if (rc != 0) {
-            return rc;
+            goto done;
         }
     }
 
@@ -2426,7 +2426,7 @@ ble_gap_connect(uint8_t own_addr_type, const ble_addr_t 
*peer_addr,
 
     rc = ble_hs_id_use_addr(own_addr_type);
     if (rc != 0) {
-        return rc;
+        goto done;
     }
 
     BLE_HS_LOG(INFO, "GAP procedure initiated: connect; ");

Reply via email to