Skip to content

Commit

Permalink
nimble/host: Clear ATT queue on conn_free
Browse files Browse the repository at this point in the history
We need to free all mbufs enqueued on ATT queue when connection is
freed, otherwise we may leak mbufs.
  • Loading branch information
andrzej-kaczmarek committed Oct 16, 2024
1 parent 1d866e4 commit bda4b0c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nimble/host/src/ble_hs_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bda4b0c

Please sign in to comment.