diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp index 0a5c89aa66..fc14d0d316 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow.cpp @@ -141,7 +141,7 @@ void AP_OpticalFlow::init(uint32_t log_bit) break; case Type::BEBOP: #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP - backend = new AP_OpticalFlow_Onboard(*this); + backend = NEW_NOTHROW AP_OpticalFlow_Onboard(*this); #endif break; case Type::CXOF: @@ -156,7 +156,7 @@ void AP_OpticalFlow::init(uint32_t log_bit) break; case Type::UAVCAN: #if AP_OPTICALFLOW_HEREFLOW_ENABLED - backend = new AP_OpticalFlow_HereFlow(*this); + backend = NEW_NOTHROW AP_OpticalFlow_HereFlow(*this); #endif break; case Type::MSP: @@ -171,7 +171,7 @@ void AP_OpticalFlow::init(uint32_t log_bit) break; case Type::SITL: #if AP_OPTICALFLOW_SITL_ENABLED - backend = new AP_OpticalFlow_SITL(*this); + backend = NEW_NOTHROW AP_OpticalFlow_SITL(*this); #endif break; } @@ -243,7 +243,7 @@ void AP_OpticalFlow::handle_msp(const MSP::msp_opflow_data_message_t &pkt) void AP_OpticalFlow::start_calibration() { if (_calibrator == nullptr) { - _calibrator = new AP_OpticalFlow_Calibrator(); + _calibrator = NEW_NOTHROW AP_OpticalFlow_Calibrator(); if (_calibrator == nullptr) { GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "FlowCal: failed to start"); return; diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_CXOF.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_CXOF.cpp index af3180b95d..f27e5f0aca 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_CXOF.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_CXOF.cpp @@ -72,7 +72,7 @@ AP_OpticalFlow_CXOF *AP_OpticalFlow_CXOF::detect(AP_OpticalFlow &_frontend) } // we have found a serial port so use it - AP_OpticalFlow_CXOF *sensor = new AP_OpticalFlow_CXOF(_frontend, uart); + AP_OpticalFlow_CXOF *sensor = NEW_NOTHROW AP_OpticalFlow_CXOF(_frontend, uart); return sensor; } diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_MAV.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_MAV.cpp index 7a84b17623..9d26f141c2 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_MAV.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_MAV.cpp @@ -26,7 +26,7 @@ AP_OpticalFlow_MAV *AP_OpticalFlow_MAV::detect(AP_OpticalFlow &_frontend) { // we assume mavlink messages will be sent into this driver - AP_OpticalFlow_MAV *sensor = new AP_OpticalFlow_MAV(_frontend); + AP_OpticalFlow_MAV *sensor = NEW_NOTHROW AP_OpticalFlow_MAV(_frontend); return sensor; } diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_MSP.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_MSP.cpp index eaff53fde2..8923a5846b 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_MSP.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_MSP.cpp @@ -29,7 +29,7 @@ using namespace MSP; AP_OpticalFlow_MSP *AP_OpticalFlow_MSP::detect(AP_OpticalFlow &_frontend) { // we assume msp messages will be sent into this driver - return new AP_OpticalFlow_MSP(_frontend); + return NEW_NOTHROW AP_OpticalFlow_MSP(_frontend); } // read latest values from sensor and fill in x,y and totals. diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_PX4Flow.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_PX4Flow.cpp index 0f72760d02..17380ed38a 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_PX4Flow.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_PX4Flow.cpp @@ -40,7 +40,7 @@ extern const AP_HAL::HAL& hal; // detect the device AP_OpticalFlow_PX4Flow *AP_OpticalFlow_PX4Flow::detect(AP_OpticalFlow &_frontend) { - AP_OpticalFlow_PX4Flow *sensor = new AP_OpticalFlow_PX4Flow(_frontend); + AP_OpticalFlow_PX4Flow *sensor = NEW_NOTHROW AP_OpticalFlow_PX4Flow(_frontend); if (!sensor) { return nullptr; } diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_Pixart.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_Pixart.cpp index 5a976c8a3e..373c044ef3 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_Pixart.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_Pixart.cpp @@ -94,7 +94,7 @@ AP_OpticalFlow_Pixart::AP_OpticalFlow_Pixart(const char *devname, AP_OpticalFlow // detect the device AP_OpticalFlow_Pixart *AP_OpticalFlow_Pixart::detect(const char *devname, AP_OpticalFlow &_frontend) { - AP_OpticalFlow_Pixart *sensor = new AP_OpticalFlow_Pixart(devname, _frontend); + AP_OpticalFlow_Pixart *sensor = NEW_NOTHROW AP_OpticalFlow_Pixart(devname, _frontend); if (!sensor) { return nullptr; } diff --git a/libraries/AP_OpticalFlow/AP_OpticalFlow_UPFLOW.cpp b/libraries/AP_OpticalFlow/AP_OpticalFlow_UPFLOW.cpp index a4af1d4c86..6452cc1532 100644 --- a/libraries/AP_OpticalFlow/AP_OpticalFlow_UPFLOW.cpp +++ b/libraries/AP_OpticalFlow/AP_OpticalFlow_UPFLOW.cpp @@ -74,7 +74,7 @@ AP_OpticalFlow_UPFLOW *AP_OpticalFlow_UPFLOW::detect(AP_OpticalFlow &_frontend) } // we have found a serial port so use it - AP_OpticalFlow_UPFLOW *sensor = new AP_OpticalFlow_UPFLOW(_frontend, uart); + AP_OpticalFlow_UPFLOW *sensor = NEW_NOTHROW AP_OpticalFlow_UPFLOW(_frontend, uart); return sensor; }