AC_Avoidance: check for alloc failure of ObjectBuffer

This commit is contained in:
Andrew Tridgell 2023-01-02 08:33:22 +11:00
parent 57ee3a4e02
commit e184e78e52
1 changed files with 5 additions and 0 deletions

View File

@ -187,6 +187,11 @@ void AP_OADatabase::init_queue()
}
_queue.items = new ObjectBuffer<OA_DbItem>(_queue.size);
if (_queue.items != nullptr && _queue.items->get_size() == 0) {
// allocation failed
delete _queue.items;
_queue.items = nullptr;
}
}
void AP_OADatabase::init_database()