mirror of https://github.com/ARMmbed/mbed-os.git
Add check so that FlashIAP does not allocate memory on flash_init failure.
parent
fc5f3259de
commit
2f97c2d747
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue