This is an automated email from the ASF dual-hosted git repository. andk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push: new bda4b0c67 nimble/host: Clear ATT queue on conn_free bda4b0c67 is described below commit bda4b0c67d2cc66254e9d097aa9e499ba21b2dd8 Author: Andrzej Kaczmarek <andrzej.kaczma...@codecoup.pl> AuthorDate: Wed Oct 16 02:36:43 2024 +0200 nimble/host: Clear ATT queue on conn_free We need to free all mbufs enqueued on ATT queue when connection is freed, otherwise we may leak mbufs. --- nimble/host/src/ble_hs_conn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nimble/host/src/ble_hs_conn.c b/nimble/host/src/ble_hs_conn.c index 57ba16af8..1e83d33de 100644 --- a/nimble/host/src/ble_hs_conn.c +++ b/nimble/host/src/ble_hs_conn.c @@ -255,6 +255,11 @@ ble_hs_conn_free(struct ble_hs_conn *conn) os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp)); } + while ((omp = STAILQ_FIRST(&conn->att_tx_q)) != NULL) { + STAILQ_REMOVE_HEAD(&conn->att_tx_q, omp_next); + os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp)); + } + #if MYNEWT_VAL(BLE_HS_DEBUG) memset(conn, 0xff, sizeof *conn); #endif