diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 63d7bb049..c28db4fa2 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -453,7 +453,7 @@ void setup(void) { // Init settings and logging preparing for AddLog use #ifdef PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED ESP.setIramHeap(); - Settings = (TSettings*)calloc(sizeof(TSettings), 1); // Allocate in "new" 16k heap space + Settings = (TSettings*)calloc(1, sizeof(TSettings)); // Allocate in "new" 16k heap space TasmotaGlobal.log_buffer = (char*)malloc(LOG_BUFFER_SIZE); // Allocate in "new" 16k heap space ESP.resetHeap(); if (TasmotaGlobal.log_buffer == nullptr) { @@ -464,7 +464,7 @@ void setup(void) { } #endif // PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED if (Settings == nullptr) { - Settings = (TSettings*)calloc(sizeof(TSettings), 1); + Settings = (TSettings*)calloc(1, sizeof(TSettings)); } #ifdef ESP32 diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 165a45e10..dd1cf61d2 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -434,7 +434,7 @@ bool SettingsBufferAlloc(uint32_t upload_size) { } - if (!(settings_buffer = (uint8_t *)calloc(settings_size, 1))) { + if (!(settings_buffer = (uint8_t *)calloc(1, settings_size))) { AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_UPLOAD_ERR_2)); // Not enough (memory) space return false; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino index 8449d22c7..0d15ffd4f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino @@ -1142,7 +1142,7 @@ void CmndMaxEnergyStart(void) { /********************************************************************************************/ void EnergyDrvInit(void) { - Energy = (tEnergy*)calloc(sizeof(tEnergy), 1); // Need calloc to reset registers to 0/false + Energy = (tEnergy*)calloc(1, sizeof(tEnergy)); // Need calloc to reset registers to 0/false if (!Energy) { return; } Energy->value = nullptr; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino index 05e17d5f1..64f4f271a 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino @@ -1375,7 +1375,7 @@ void CmndMaxEnergyStart(void) { /********************************************************************************************/ void EnergyDrvInit(void) { - Energy = (tEnergy*)calloc(sizeof(tEnergy), 1); // Need calloc to reset registers to 0/false + Energy = (tEnergy*)calloc(1, sizeof(tEnergy)); // Need calloc to reset registers to 0/false if (!Energy) { return; } Energy->value = nullptr; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino index 99acd19ba..869742ad4 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino @@ -529,7 +529,7 @@ void DomoticzSensorP1SmartMeter(char *usage1, char *usage2, char *return1, char void DomoticzInit(void) { if (Settings->flag.mqtt_enabled) { // SetOption3 - Enable MQTT - Domoticz = (Domoticz_t*)calloc(sizeof(Domoticz_t), 1); // Need calloc to reset registers to 0/false + Domoticz = (Domoticz_t*)calloc(1, sizeof(Domoticz_t)); // Need calloc to reset registers to 0/false if (nullptr == Domoticz) { return; } Domoticz->update_flag = true;