Cleanup: avoid memory leak
Coverity CID 207731 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fc20155d52
commit
76eb18ff18
@ -477,6 +477,7 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb
|
|||||||
WARNING(abstract->context, "Skipped unreadable dive!");
|
WARNING(abstract->context, "Skipped unreadable dive!");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
dc_buffer_free(buffer);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,8 +501,10 @@ divesystem_idive_device_foreach (dc_device_t *abstract, dc_dive_callback_t callb
|
|||||||
(idx ) & 0xFF,
|
(idx ) & 0xFF,
|
||||||
(idx >> 8) & 0xFF};
|
(idx >> 8) & 0xFF};
|
||||||
rc = divesystem_idive_transfer (device, cmd_sample, sizeof(cmd_sample), packet, commands->sample.size * commands->nsamples, &errcode);
|
rc = divesystem_idive_transfer (device, cmd_sample, sizeof(cmd_sample), packet, commands->sample.size * commands->nsamples, &errcode);
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS) {
|
||||||
|
dc_buffer_free(buffer);
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
// If the number of samples is not an exact multiple of the
|
// If the number of samples is not an exact multiple of the
|
||||||
// number of samples per packet, then the last packet
|
// number of samples per packet, then the last packet
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user