You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2017/02/23 22:33:05 UTC

[11/50] incubator-mynewt-core git commit: MYNEWT-579 Free rxed l2cap frags on disconnect.

MYNEWT-579 Free rxed l2cap frags on disconnect.

This may not a different mbuf leak, but it was discovered while
debugging this issue.


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

Branch: refs/heads/sensors_branch
Commit: 206d7fdb9ab7751ebfc276fc551767949e9a2eab
Parents: 8518805
Author: Christopher Collins <cc...@apache.org>
Authored: Sat Feb 11 12:05:08 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Sat Feb 11 12:07:45 2017 -0800

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap.c           | 2 ++
 net/nimble/host/test/src/ble_l2cap_test.c | 5 +++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/206d7fdb/net/nimble/host/src/ble_l2cap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap.c b/net/nimble/host/src/ble_l2cap.c
index fc8ecb9..fa02ec2 100644
--- a/net/nimble/host/src/ble_l2cap.c
+++ b/net/nimble/host/src/ble_l2cap.c
@@ -75,6 +75,8 @@ ble_l2cap_chan_free(struct ble_l2cap_chan *chan)
         return;
     }
 
+    os_mbuf_free_chain(chan->blc_rx_buf);
+
     rc = os_memblock_put(&ble_l2cap_chan_pool, chan);
     BLE_HS_DBG_ASSERT_EVAL(rc == 0);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/206d7fdb/net/nimble/host/test/src/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_l2cap_test.c b/net/nimble/host/test/src/ble_l2cap_test.c
index 526436c..2681b26 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -367,6 +367,11 @@ TEST_CASE(ble_l2cap_test_case_frag_channels)
     TEST_ASSERT(conn->bhc_rx_chan != NULL &&
                 conn->bhc_rx_chan->blc_cid == BLE_L2CAP_CID_ATT);
     ble_hs_unlock();
+
+    /* Terminate the connection.  The received fragments should get freed.
+     * Mbuf leaks are tested in the post-test-case callback.
+     */
+    ble_hs_test_util_conn_disconnect(2);
 }
 
 TEST_CASE(ble_l2cap_test_case_frag_timeout)