mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-02 15:19:30 +01:00
nvs: fix memory leak when writing a blob
Introduced in 5a27a63.
Clear usedPages list in all exit conditions, add test.
This commit is contained in:
@@ -236,10 +236,9 @@ esp_err_t Storage::writeMultiPageBlob(uint8_t nsIndex, const char* key, const vo
|
||||
for (auto it = std::begin(usedPages); it != std::end(usedPages); it++) {
|
||||
it->mPage->eraseItem(nsIndex, ItemType::BLOB_DATA, key, ii++);
|
||||
}
|
||||
usedPages.clearAndFreeNodes();
|
||||
return err;
|
||||
}
|
||||
return ESP_OK;
|
||||
usedPages.clearAndFreeNodes();
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t Storage::writeItem(uint8_t nsIndex, ItemType datatype, const char* key, const void* data, size_t dataSize)
|
||||
|
||||
Reference in New Issue
Block a user