fixing memory leaks and Veto mechanics

This commit is contained in:
2025-04-08 23:34:07 +02:00
parent 858b7d81cc
commit 2397789047
9 changed files with 212 additions and 353 deletions
+13 -43
View File
@@ -726,54 +726,20 @@ void onProjectUpdate(SPIT_Client::ProjUpdate state, string projectId) {
}
}
/**
* The SPITCLientInterface (implemented by this) will be asked to veto the SPITType while SPIT_Client.parseReportSPITType.<br>
* @param p_ReportSPITType
* @return false = the SPITType is denied, true = the SPITType is accepted
*/
bool onCheckSpitTypeVeto(SPIT_Message::ReportSPITType *p_ReportSPITType) {
return true; // Bypass veto
bool onCheckSpitTypeVeto(bool knownType, bool createdByClient) {
if (!knownType || !createdByClient) { // Don't allow foreign SPITTypes
return false;
}
// if (p_ReportSPITType == nullptr)
// return true;
// SPITType *ptrSPITType;
// ptrSPITType = SPITType::getSPITType(p_ReportSPITType->getID());
// Don't allow foreign SPITTypes
// if (ptrSPITType == nullptr) {
// // ESP_LOGW(TAG, "ObjectVeto NoSpitType");
// return false;
// }
// if (ptrSPITType->getCreatedByClient() == false) {
// // ESP_LOGW(TAG, "getCreatedByClient");
// return false;
// }
return true;
}
bool onCheckSpitObjectVeto(SPIT_Message::ReportSPITObject *p_ReportSPITObject) {
bool onCheckSpitObjectVeto(bool knownType) {
return true; // Bypass veto
if (p_ReportSPITObject == nullptr)
return true;
// SPITType *ptrSPITType = SPITType::getSPITType(p_ReportSPITObject->getSPITTypeID());
// if (ptrSPITType == nullptr) {
// // ESP_LOGW(TAG, "ObjectVeto NoSpitObj");
// return false;
// }
// Don't allow SPITObjects which refers to a SPITType which is not created by this client - other SPITTypes cannot be handled here
// if (ptrSPITType->getCreatedByClient() == false) {
// // ESP_LOGW(TAG, "getCreatedByClient");
// return false;
// }
// SPITObject *ptrSPITObject = SPITObject::getSPITObject(p_ReportSPITObject->getID());
// // Don't allow foreign SPITTypes
// if (ptrSPITObject == nullptr) {
// // ESP_LOGE(TAG, "Unknown ID");
// return false;
// }
if (!knownType) { // Don't allow objects of unregistered SPITTypes
return false;
}
return true;
}
@@ -1021,5 +987,9 @@ void app_main(void) {
fos::Task::delayMs(5000);
// ToDo send
Syslog::logv(Syslog::Severity::Notice, "Health state");
// ESP_LOGI(TAG, "Min heap size: %" PRIu32 " / FreeHeap %" PRIu32 "\n",
ESP_LOGI(TAG, "Min heap size: %u / FreeHeap %lu",
heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT),
esp_get_free_heap_size());
}
}