mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
uORB: fix hardfault in uORB calloc implementation
When running out-of-memory, the malloc returns NULL and the memset then tries to write to address 0 which results in a hardfault.
This commit is contained in:
@@ -188,7 +188,10 @@ uORB::DeviceNode::write(cdev::file_t *filp, const char *buffer, size_t buflen)
|
||||
if (nullptr == _data) {
|
||||
const size_t data_size = _meta->o_size * _queue_size;
|
||||
_data = (uint8_t *) px4_cache_aligned_alloc(data_size);
|
||||
memset(_data, 0, data_size);
|
||||
|
||||
if (_data) {
|
||||
memset(_data, 0, data_size);
|
||||
}
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
Reference in New Issue
Block a user