mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12531 from dustin-crossman/pr/flashiap_fix
Add check so that FlashIAP does not allocate memory on flash_init failurepull/12594/head
commit
ea3761f38d
|
@ -59,8 +59,12 @@ int FlashIAP::init()
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not allocate if flash_init failed
|
||||||
|
if (ret == 0) {
|
||||||
uint32_t page_size = get_page_size();
|
uint32_t page_size = get_page_size();
|
||||||
_page_buf = new uint8_t[page_size];
|
_page_buf = new uint8_t[page_size];
|
||||||
|
}
|
||||||
|
|
||||||
_mutex->unlock();
|
_mutex->unlock();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue