Skip to content

Commit bda4b0c

Browse files
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.
1 parent 1d866e4 commit bda4b0c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nimble/host/src/ble_hs_conn.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ ble_hs_conn_free(struct ble_hs_conn *conn)
255255
os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp));
256256
}
257257

258+
while ((omp = STAILQ_FIRST(&conn->att_tx_q)) != NULL) {
259+
STAILQ_REMOVE_HEAD(&conn->att_tx_q, omp_next);
260+
os_mbuf_free_chain(OS_MBUF_PKTHDR_TO_MBUF(omp));
261+
}
262+
258263
#if MYNEWT_VAL(BLE_HS_DEBUG)
259264
memset(conn, 0xff, sizeof *conn);
260265
#endif

0 commit comments

Comments
 (0)