Skip to content

Commit

Permalink
Merge branch 'bugfix/nvs_memory_issue' into 'master'
Browse files Browse the repository at this point in the history
bugfix(nvs_flash): fixed potential memory leak in nvs::Storage::init()

Closes IDF-6481

See merge request espressif/esp-idf!21619
  • Loading branch information
david-cermak committed Dec 15, 2022
2 parents 7283a40 + e6ca481 commit 52cfc01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/nvs_flash/src/nvs_storage.cpp
Expand Up @@ -116,12 +116,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;
}
}
Expand Down

0 comments on commit 52cfc01

Please sign in to comment.