mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11595 from SeppoTakalo/IOTSTOR-944
Check return of BlockDevice::init() in TDBStore.pull/11618/head
commit
f5b5989fc8
|
@ -1019,7 +1019,10 @@ int TDBStore::init()
|
|||
_size = (size_t) -1;
|
||||
|
||||
_buff_bd = new BufferedBlockDevice(_bd);
|
||||
_buff_bd->init();
|
||||
ret = _buff_bd->init();
|
||||
if (ret) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// Underlying BD must have flash attributes, i.e. have an erase value
|
||||
if (_bd->get_erase_value() == -1) {
|
||||
|
@ -1140,6 +1143,19 @@ end:
|
|||
_is_initialized = true;
|
||||
_mutex.unlock();
|
||||
return ret;
|
||||
fail:
|
||||
delete[] ram_table;
|
||||
delete _buff_bd;
|
||||
delete[] _work_buf;
|
||||
delete[] _key_buf;
|
||||
delete reinterpret_cast<inc_set_handle_t *>(_inc_set_handle);
|
||||
_ram_table = nullptr;
|
||||
_buff_bd = nullptr;
|
||||
_work_buf = nullptr;
|
||||
_key_buf = nullptr;
|
||||
_inc_set_handle = nullptr;
|
||||
_mutex.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int TDBStore::deinit()
|
||||
|
|
|
@ -61,8 +61,7 @@ public:
|
|||
* the available data and clean corrupted and erroneous records.
|
||||
*
|
||||
* @returns MBED_SUCCESS Success.
|
||||
* MBED_ERROR_READ_FAILED Unable to read from media.
|
||||
* MBED_ERROR_WRITE_FAILED Unable to write to media.
|
||||
* @returns Negative error code on failure.
|
||||
*/
|
||||
virtual int init();
|
||||
|
||||
|
|
Loading…
Reference in New Issue