Add check so that FlashIAP does not allocate memory on flash_init failure.

pull/12531/head
Dustin Crossman 2020-02-24 11:10:17 -08:00
parent fc5f3259de
commit 2f97c2d747
1 changed files with 6 additions and 2 deletions

View File

@ -59,8 +59,12 @@ int FlashIAP::init()
ret = -1;
}
}
uint32_t page_size = get_page_size();
_page_buf = new uint8_t[page_size];
// Do not allocate if flash_init failed
if (ret == 0) {
uint32_t page_size = get_page_size();
_page_buf = new uint8_t[page_size];
}
_mutex->unlock();
return ret;