Fix ESP32 CC2530 heap corruption

Fix ESP32 CC2530 heap corruption (#10121)
This commit is contained in:
Theo Arends 2020-12-14 14:37:50 +01:00
parent a5134729ed
commit 0bf82f51dd

View File

@ -304,7 +304,7 @@ void loadZigbeeDevices(bool dump_only = false) {
AddLog_P(LOG_LEVEL_ERROR, PSTR(D_LOG_ZIGBEE "Cannot allocate 4KB buffer"));
return;
}
ZigbeeRead(&spi_buffer, z_spi_len);
ZigbeeRead(spi_buffer, z_spi_len);
z_dev_start = spi_buffer;
#endif // ESP32
Z_Flashentry flashdata;
@ -367,7 +367,7 @@ void saveZigbeeDevices(void) {
ESP.flashRead(z_spi_start_sector * SPI_FLASH_SEC_SIZE, (uint32_t*) spi_buffer, SPI_FLASH_SEC_SIZE);
#endif // ESP8266
#ifdef ESP32
ZigbeeRead(&spi_buffer, z_spi_len);
ZigbeeRead(spi_buffer, z_spi_len);
#endif // ESP32
Z_Flashentry *flashdata = (Z_Flashentry*)(spi_buffer + z_block_offset);
@ -385,7 +385,7 @@ void saveZigbeeDevices(void) {
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data store in Flash (0x%08X - %d bytes)"), z_dev_start, buf_len);
#endif // ESP8266
#ifdef ESP32
ZigbeeWrite(&spi_buffer, z_spi_len);
ZigbeeWrite(spi_buffer, z_spi_len);
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee Devices Data saved in %s (%d bytes)"), PSTR("Flash"), buf_len);
#endif // ESP32
free(spi_buffer);