Fix a few memory leaks.
This commit is contained in:
parent
6df4f00822
commit
d1121d174c
@ -501,6 +501,7 @@ suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char
|
|||||||
|
|
||||||
if (libusb_init(&eon->ctx)) {
|
if (libusb_init(&eon->ctx)) {
|
||||||
ERROR(context, "libusb_init() failed");
|
ERROR(context, "libusb_init() failed");
|
||||||
|
free(eon);
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,6 +509,7 @@ suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char
|
|||||||
if (!eon->handle) {
|
if (!eon->handle) {
|
||||||
ERROR(context, "unable to open device");
|
ERROR(context, "unable to open device");
|
||||||
libusb_exit(eon->ctx);
|
libusb_exit(eon->ctx);
|
||||||
|
free(eon);
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +521,9 @@ suunto_eonsteel_device_open(dc_device_t **out, dc_context_t *context, const char
|
|||||||
|
|
||||||
if (initialize_eonsteel(eon) < 0) {
|
if (initialize_eonsteel(eon) < 0) {
|
||||||
ERROR(context, "unable to initialize device");
|
ERROR(context, "unable to initialize device");
|
||||||
|
libusb_close(eon->handle);
|
||||||
libusb_exit(eon->ctx);
|
libusb_exit(eon->ctx);
|
||||||
|
free(eon);
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user