Skip to content
Snippets Groups Projects
Commit 1da87aa1 authored by DanielePettenuzzo's avatar DanielePettenuzzo Committed by Daniel Agar
Browse files

Vl53lxx Driver Coverity Fixes (#9671)

parent 3098b09b
No related branches found
No related tags found
No related merge requests found
......@@ -213,7 +213,8 @@ VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) :
_orb_class_instance(-1),
_distance_sensor_topic(nullptr),
_sample_perf(perf_alloc(PC_ELAPSED, "vl53lxx_read")),
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err"))
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err")),
_stop_variable(0)
{
// up the retries since the device misses the first measure attempts
I2C::_retries = 3;
......@@ -989,7 +990,7 @@ void info();
void
start(uint8_t rotation)
{
int fd;
int fd = -1;
if (g_dev != nullptr) {
errx(1, "already started");
......@@ -1022,6 +1023,10 @@ start(uint8_t rotation)
fail:
if (fd >= 0) {
close(fd);
}
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
......@@ -1073,6 +1078,8 @@ test()
print_message(report);
close(fd);
errx(0, "PASS");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment