NVS: Changed all new to new (nothrow)

This commit is contained in:
Jakob Hasse
2019-12-06 14:36:28 +08:00
parent 34fd845242
commit c75ec644f4
10 changed files with 99 additions and 32 deletions
+4 -2
View File
@@ -21,7 +21,9 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount)
mPageCount = sectorCount;
mPageList.clear();
mFreePageList.clear();
mPages.reset(new Page[sectorCount]);
mPages.reset(new (nothrow) Page[sectorCount]);
if (!mPages) return ESP_ERR_NO_MEM;
for (uint32_t i = 0; i < sectorCount; ++i) {
auto err = mPages[i].load(baseSector + i);
@@ -85,7 +87,7 @@ esp_err_t PageManager::load(uint32_t baseSector, uint32_t sectorCount)
break;
}
}
}
}
}
// check if power went out while page was being freed