mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_Linux: check for alloc failure of ObjectBuffer
This commit is contained in:
parent
c602757c02
commit
54c3e7f74b
|
@ -171,6 +171,11 @@ void OpticalFlow_Onboard::init()
|
|||
}
|
||||
|
||||
_gyro_ring_buffer = new ObjectBuffer<GyroSample>(OPTICAL_FLOW_GYRO_BUFFER_LEN);
|
||||
if (_gyro_ring_buffer != nullptr && _gyro_ring_buffer->get_size() == 0) {
|
||||
// allocation failed
|
||||
delete _gyro_ring_buffer;
|
||||
_gyro_ring_buffer = nullptr;
|
||||
}
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue