We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5e758f commit 2eb0bcaCopy full SHA for 2eb0bca
features/filesystem/bd/MemBlockDevice.cpp
@@ -31,20 +31,18 @@ MemBlockDevice::~MemBlockDevice()
31
free(_blocks[i]);
32
}
33
34
- free(_blocks);
+ delete[] _blocks;
35
_blocks = 0;
36
37
38
39
bd_error_t MemBlockDevice::init()
40
{
41
if (!_blocks) {
42
- _blocks = (uint8_t**)malloc(_count*sizeof(uint8_t*));
43
- if (!_blocks) {
44
- return BD_ERROR_DEVICE_ERROR;
+ _blocks = new uint8_t*[_count];
+ for (unsigned i = 0; i < _count; i++) {
+ _blocks[i] = 0;
45
46
-
47
- memset(_blocks, 0, _count*sizeof(uint8_t*));
48
49
50
return BD_ERROR_OK;
0 commit comments