mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00: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