You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/05/19 19:57:16 UTC
incubator-mynewt-core git commit: BLE Host - dbg,
ensure sm proc not in list on free
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 317a23bd6 -> b1858ea16
BLE Host - dbg, ensure sm proc not in list on free
This code only runs when BLE_HS_DEBUG is defined (generally just during
unit tests). This change would have caught a bug that got fixed a few
days ago.
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/b1858ea1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b1858ea1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b1858ea1
Branch: refs/heads/develop
Commit: b1858ea16993e71e7c4fabfe48d0c6ddc554b1df
Parents: 317a23b
Author: Christopher Collins <cc...@apache.org>
Authored: Thu May 19 12:55:40 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu May 19 12:56:37 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1858ea1/net/nimble/host/src/ble_l2cap_sm.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sm.c b/net/nimble/host/src/ble_l2cap_sm.c
index 6adc820..adc52d8 100644
--- a/net/nimble/host/src/ble_l2cap_sm.c
+++ b/net/nimble/host/src/ble_l2cap_sm.c
@@ -238,6 +238,18 @@ ble_l2cap_sm_dbg_assert_no_cycles(void)
#endif
}
+static void
+ble_l2cap_sm_dbg_assert_not_inserted(struct ble_l2cap_sm_proc *proc)
+{
+#if BLE_HS_DEBUG
+ struct ble_l2cap_sm_proc *cur;
+
+ STAILQ_FOREACH(cur, &ble_l2cap_sm_procs, next) {
+ BLE_HS_DBG_ASSERT(cur != proc);
+ }
+#endif
+}
+
/*****************************************************************************
* $misc *
*****************************************************************************/
@@ -432,6 +444,8 @@ ble_l2cap_sm_proc_free(struct ble_l2cap_sm_proc *proc)
int rc;
if (proc != NULL) {
+ ble_l2cap_sm_dbg_assert_not_inserted(proc);
+
rc = os_memblock_put(&ble_l2cap_sm_proc_pool, proc);
BLE_HS_DBG_ASSERT_EVAL(rc == 0);
}