AP_Periph: fixed array delete in batt_balance

This commit is contained in:
Andrew Tridgell 2023-09-28 09:32:16 +10:00
parent 50ae89ed8c
commit 13765ec9ee
1 changed files with 2 additions and 1 deletions

View File

@ -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