bugfix(nvs_flash): fixed potential memory leak in nvs::Storage::init()

This commit is contained in:
Jakob Hasse
2022-12-15 15:35:00 +08:00
committed by KonstantinKondrashov
parent 416ada0ce1
commit 0eddee63e8

View File

@ -112,12 +112,14 @@ esp_err_t Storage::init(uint32_t baseSector, uint32_t sectorCount)
item.getKey(entry->mName, sizeof(entry->mName));
err = item.getValue(entry->mIndex);
if (err != ESP_OK) {
delete entry;
return err;
}
mNamespaces.push_back(entry);
if (mNamespaceUsage.set(entry->mIndex, true) != ESP_OK) {
delete entry;
return ESP_FAIL;
}
mNamespaces.push_back(entry);
itemIndex += item.span;
}
}