mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 04:23:33 +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);
|
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;
|
delete bus.dev;
|
||||||
bus.dev = NULL;
|
bus.dev = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user