This is an automated email from the ASF dual-hosted git repository. janc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 40ef752bf388a131ebcf31b1e6658e0611ddcf7d Author: Szymon Janc <[email protected]> AuthorDate: Wed Nov 19 12:36:40 2025 +0100 nimble/host/test: Fix memory leaks in L2CAP tests Heap memmory was never freed but since there is no need for it just use stack buffers. --- nimble/host/test/src/ble_l2cap_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nimble/host/test/src/ble_l2cap_test.c b/nimble/host/test/src/ble_l2cap_test.c index 6fd294b82..9ea7f8533 100644 --- a/nimble/host/test/src/ble_l2cap_test.c +++ b/nimble/host/test/src/ble_l2cap_test.c @@ -765,14 +765,16 @@ ble_l2cap_test_coc_connect_multi(struct test_data *t) { struct ble_l2cap_sig_credit_base_connect_req *req; struct ble_l2cap_sig_credit_base_connect_rsp *rsp; + uint8_t req_buf[sizeof(*req) + (sizeof(uint16_t) * t->num)]; + uint8_t rsp_buf[sizeof(*rsp) + (sizeof(uint16_t) * t->num)]; struct os_mbuf *sdu_rx[t->num]; struct event *ev = &t->event[t->event_iter++]; uint8_t id; int rc; int i; - req = malloc(sizeof(*req) + (sizeof(uint16_t) * t->num)); - rsp = malloc(sizeof(*rsp) + (sizeof(uint16_t) * t->num)); + req = (void *)req_buf; + rsp = (void *)rsp_buf; ble_l2cap_test_util_init();
