mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
bmp280 properly cleanup if failed
This commit is contained in:
parent
936f92fd0b
commit
95eaac6876
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user