mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 17:35:22 +08:00
bmp280 properly cleanup if failed
This commit is contained in:
@@ -669,9 +669,13 @@ start_bus(struct bmp280_bus_option &bus)
|
||||
|
||||
bus.dev = new BMP280(interface, bus.devpath);
|
||||
|
||||
if (bus.dev != nullptr && OK != bus.dev->init()) {
|
||||
if (bus.dev == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OK != bus.dev->init()) {
|
||||
delete bus.dev;
|
||||
bus.dev = NULL;
|
||||
bus.dev = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user