mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-05 00:30:16 +01:00
nvs_flash: Multi-page blob erased using nvs_erase_key should be cleaned properly
Earlier eraseItem function in Storage class would do lazy cleanup of multi-page blobs if called using type "ANY" instead of "BLOB". It used to just delete BLOB data and index would remain as is. Any subsequent read would delete index entry as well. This however would return a valid length without error if nvs_get_blob API was just used for finding length and not reading the complete blob. This change fixes this issue. Closes https://github.com/espressif/esp-idf/issues/3255
This commit is contained in:
@@ -528,6 +528,10 @@ esp_err_t Storage::eraseItem(uint8_t nsIndex, ItemType datatype, const char* key
|
||||
return err;
|
||||
}
|
||||
|
||||
if (item.datatype == ItemType::BLOB_DATA || item.datatype == ItemType::BLOB_IDX) {
|
||||
return eraseMultiPageBlob(nsIndex, key);
|
||||
}
|
||||
|
||||
return findPage->eraseItem(nsIndex, datatype, key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user