From 73639cf0b4d7e02554140a88988c63ba6094be06 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Tue, 18 Apr 2023 15:01:09 +0530 Subject: [PATCH] Nimble: Fixes for memory leak / optimization --- components/bt/host/nimble/Kconfig.in | 2 +- components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index 61c82cb39a..e904260067 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -479,7 +479,7 @@ config BT_NIMBLE_HS_STOP_TIMEOUT_MS config BT_NIMBLE_HOST_BASED_PRIVACY bool "Enable host based privacy for random address." default n - depends on BT_NIMBLE_ENABLED && !IDF_TARGET_ESP32 + depends on BT_NIMBLE_ENABLED && IDF_TARGET_ESP32 help Use this option to do host based Random Private Address resolution. If this option is disabled then controller based privacy is used. diff --git a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c index 40b8a65364..4196ba4f2e 100644 --- a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c +++ b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c @@ -216,6 +216,7 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len) assert(evbuf != NULL); } + memset(evbuf, 0, sizeof *evbuf); memcpy(evbuf, &data[1], totlen); rc = ble_hci_trans_ll_evt_tx(evbuf);