[PATCH 03/12] Cleanup: avoid memory leak

Dirk Hohndel dirk at hohndel.org
Thu Jan 4 08:50:18 PST 2018


Coverity CID 207807

Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
---
 src/scubapro_g2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/scubapro_g2.c b/src/scubapro_g2.c
index dcef6278593c..c6c533fbe05e 100644
--- a/src/scubapro_g2.c
+++ b/src/scubapro_g2.c
@@ -245,7 +245,8 @@ scubapro_g2_device_open(dc_device_t **out, dc_context_t *context, const char *na
 		const struct usb_id *id = get_usb_id(model);
 		if (!id) {
 			ERROR(context, "Unknown USB ID for Scubapro model %#04x", model);
-			return DC_STATUS_IO;
+			status = DC_STATUS_IO;
+			goto error_free;
 		}
 		status = dc_usbhid_custom_io(context, id->vendor, id->device);
 	}
-- 
2.15.1



More information about the devel mailing list