mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [23/26] incubator-mynewt-core git commit: nimble/l2cap: Fix for possible memory leak
Date Fri, 03 Mar 2017 17:36:38 GMT
nimble/l2cap: Fix for possible memory leak

With this patch we remove allocated memory for proc in case we could
not allocate signaling request later on.


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/34e64862
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/34e64862
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/34e64862

Branch: refs/heads/develop
Commit: 34e648624d8b005a1aec4bd6ecb1b6a6a3b3cafa
Parents: 44df175
Author: Łukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Authored: Wed Mar 1 09:24:35 2017 +0100
Committer: Łukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Committed: Fri Mar 3 12:40:42 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap_sig.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/34e64862/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index a33ddef..444a8f6 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -990,7 +990,8 @@ ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan)
     req = ble_l2cap_sig_cmd_get(BLE_L2CAP_SIG_OP_DISCONN_REQ, proc->id,
                                 sizeof(*req), &txom);
     if (!req) {
-        return BLE_HS_ENOMEM;
+        rc = BLE_HS_ENOMEM;
+        goto done;
     }
 
     req->dcid = htole16(chan->dcid);
@@ -998,6 +999,7 @@ ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan)
 
     rc = ble_l2cap_sig_tx(proc->conn_handle, txom);
 
+done:
     ble_l2cap_sig_process_status(proc, rc);
 
     return rc;


Mime
View raw message