diff --git a/nimble/host/src/ble_att_svr.c b/nimble/host/src/ble_att_svr.c index 17752924b..5ca2c879f 100644 --- a/nimble/host/src/ble_att_svr.c +++ b/nimble/host/src/ble_att_svr.c @@ -2170,6 +2170,9 @@ ble_att_svr_prep_free(struct ble_att_prep_entry *entry) { if (entry != NULL) { os_mbuf_free_chain(entry->bape_value); +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(entry, 0xff, sizeof *entry); +#endif os_memblock_put(&ble_att_svr_prep_entry_pool, entry); } } diff --git a/nimble/host/src/ble_gattc.c b/nimble/host/src/ble_gattc.c index 40f4c5c85..917e21aff 100644 --- a/nimble/host/src/ble_gattc.c +++ b/nimble/host/src/ble_gattc.c @@ -710,6 +710,9 @@ ble_gattc_proc_free(struct ble_gattc_proc *proc) break; } +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(proc, 0xff, sizeof *proc); +#endif rc = os_memblock_put(&ble_gattc_proc_pool, proc); BLE_HS_DBG_ASSERT_EVAL(rc == 0); } diff --git a/nimble/host/src/ble_hs_conn.c b/nimble/host/src/ble_hs_conn.c index cef0e3a86..470f3776f 100644 --- a/nimble/host/src/ble_hs_conn.c +++ b/nimble/host/src/ble_hs_conn.c @@ -217,6 +217,9 @@ ble_hs_conn_free(struct ble_hs_conn *conn) ble_hs_conn_delete_chan(conn, chan); } +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(conn, 0xff, sizeof *conn); +#endif rc = os_memblock_put(&ble_hs_conn_pool, conn); BLE_HS_DBG_ASSERT_EVAL(rc == 0); diff --git a/nimble/host/src/ble_l2cap.c b/nimble/host/src/ble_l2cap.c index b19a34832..570498a44 100644 --- a/nimble/host/src/ble_l2cap.c +++ b/nimble/host/src/ble_l2cap.c @@ -81,6 +81,9 @@ ble_l2cap_chan_free(struct ble_l2cap_chan *chan) os_mbuf_free_chain(chan->rx_buf); ble_l2cap_coc_cleanup_chan(chan); +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(chan, 0xff, sizeof *chan); +#endif rc = os_memblock_put(&ble_l2cap_chan_pool, chan); BLE_HS_DBG_ASSERT_EVAL(rc == 0); diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c index 1840b0a41..c9c18863c 100644 --- a/nimble/host/src/ble_l2cap_sig.c +++ b/nimble/host/src/ble_l2cap_sig.c @@ -206,6 +206,9 @@ ble_l2cap_sig_proc_free(struct ble_l2cap_sig_proc *proc) if (proc != NULL) { ble_l2cap_sig_dbg_assert_proc_not_inserted(proc); +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(proc, 0xff, sizeof *proc); +#endif rc = os_memblock_put(&ble_l2cap_sig_proc_pool, proc); BLE_HS_DBG_ASSERT_EVAL(rc == 0); } diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c index ef2f41b23..82c3724f2 100644 --- a/nimble/host/src/ble_sm.c +++ b/nimble/host/src/ble_sm.c @@ -393,7 +393,9 @@ ble_sm_proc_free(struct ble_sm_proc *proc) if (proc != NULL) { ble_sm_dbg_assert_not_inserted(proc); - +#if MYNEWT_VAL(BLE_HS_DEBUG) + memset(proc, 0xff, sizeof *proc); +#endif rc = os_memblock_put(&ble_sm_proc_pool, proc); BLE_HS_DBG_ASSERT_EVAL(rc == 0); }