From 13765ec9ee2a78b58856a8c058433c44feeee427 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Sep 2023 09:32:16 +1000 Subject: [PATCH] AP_Periph: fixed array delete in batt_balance --- Tools/AP_Periph/batt_balance.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/AP_Periph/batt_balance.cpp b/Tools/AP_Periph/batt_balance.cpp index fd1fec4207..86c7c7a11c 100644 --- a/Tools/AP_Periph/batt_balance.cpp +++ b/Tools/AP_Periph/batt_balance.cpp @@ -102,6 +102,7 @@ void AP_Periph_FW::batt_balance_update() uint8_t *buffer = new uint8_t[ARDUPILOT_EQUIPMENT_POWER_BATTERYINFOAUX_MAX_SIZE]; if (pkt == nullptr || buffer == nullptr) { delete pkt; + delete [] buffer; return; } @@ -130,7 +131,7 @@ void AP_Periph_FW::batt_balance_update() total_size); delete pkt; - delete buffer; + delete [] buffer; } #endif // HAL_PERIPH_ENABLE_BATTERY_BALANCE