diff --git a/libraries/AP_DroneCAN/AP_Canard_iface.cpp b/libraries/AP_DroneCAN/AP_Canard_iface.cpp index ebece89626..8be4b0a4c2 100644 --- a/libraries/AP_DroneCAN/AP_Canard_iface.cpp +++ b/libraries/AP_DroneCAN/AP_Canard_iface.cpp @@ -30,7 +30,7 @@ HAL_Semaphore test_iface_sem; void canard_allocate_sem_take(CanardPoolAllocator *allocator) { if (allocator->semaphore == nullptr) { - allocator->semaphore = new HAL_Semaphore; + allocator->semaphore = NEW_NOTHROW HAL_Semaphore; if (allocator->semaphore == nullptr) { // out of memory CANARD_ASSERT(0); diff --git a/libraries/AP_DroneCAN/AP_DroneCAN.cpp b/libraries/AP_DroneCAN/AP_DroneCAN.cpp index 67c629b241..986f0f7600 100644 --- a/libraries/AP_DroneCAN/AP_DroneCAN.cpp +++ b/libraries/AP_DroneCAN/AP_DroneCAN.cpp @@ -343,7 +343,7 @@ void AP_DroneCAN::init(uint8_t driver_index, bool enable_filters) uint8_t uid_len = sizeof(uavcan_protocol_HardwareVersion::unique_id); uint8_t unique_id[sizeof(uavcan_protocol_HardwareVersion::unique_id)]; - mem_pool = new uint32_t[_pool_size/sizeof(uint32_t)]; + mem_pool = NEW_NOTHROW uint32_t[_pool_size/sizeof(uint32_t)]; if (mem_pool == nullptr) { debug_dronecan(AP_CANManager::LOG_ERROR, "DroneCAN: Failed to allocate memory pool\n\r"); return; diff --git a/libraries/AP_DroneCAN/AP_DroneCAN_serial.cpp b/libraries/AP_DroneCAN/AP_DroneCAN_serial.cpp index 4eb488117d..56102a4d30 100644 --- a/libraries/AP_DroneCAN/AP_DroneCAN_serial.cpp +++ b/libraries/AP_DroneCAN/AP_DroneCAN_serial.cpp @@ -52,7 +52,7 @@ void AP_DroneCAN_Serial::init(AP_DroneCAN *_dronecan) if (Canard::allocate_sub_arg_callback(dronecan, &handle_tunnel_targetted, dronecan->get_driver_index()) == nullptr) { AP_BoardConfig::allocation_error("serial_tunnel_sub"); } - targetted = new Canard::Publisher(dronecan->get_canard_iface()); + targetted = NEW_NOTHROW Canard::Publisher(dronecan->get_canard_iface()); if (targetted == nullptr) { AP_BoardConfig::allocation_error("serial_tunnel_pub"); } @@ -194,12 +194,12 @@ bool AP_DroneCAN_Serial::Port::init_buffers(const uint32_t size_rx, const uint32 } WITH_SEMAPHORE(sem); if (readbuffer == nullptr) { - readbuffer = new ByteBuffer(size_rx); + readbuffer = NEW_NOTHROW ByteBuffer(size_rx); } else { readbuffer->set_size_best(size_rx); } if (writebuffer == nullptr) { - writebuffer = new ByteBuffer(size_tx); + writebuffer = NEW_NOTHROW ByteBuffer(size_tx); } else { writebuffer->set_size_best(size_tx); }