mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'bugfix/nvs-deinit-open-handle-leak_v6.1' into 'release/v6.1'
fix(nvs_flash): delete leftover handles on partition deinit (v6.1) See merge request espressif/esp-idf!51354
This commit is contained in:
@@ -85,8 +85,11 @@ static esp_err_t close_handles_and_deinit(const char* part_name)
|
||||
|
||||
auto it = find_if(begin(s_nvs_handles), end(s_nvs_handles), belongs_to_part);
|
||||
|
||||
// Same as nvs_close(): unlink first, then delete. Deleting while still linked
|
||||
// UAF-corrupts the intrusive list (hangs host tests).
|
||||
while (it != end(s_nvs_handles)) {
|
||||
s_nvs_handles.erase(it);
|
||||
delete static_cast<NVSHandleEntry*>(it);
|
||||
it = find_if(begin(s_nvs_handles), end(s_nvs_handles), belongs_to_part);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user