From 96949627aaa5a185a623a7ddc06d81b4a4068915 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 20 Sep 2018 21:41:19 +0200 Subject: [PATCH] Fix a memory leak in the error handling --- src/oceanic_atom2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/oceanic_atom2.c b/src/oceanic_atom2.c index 8837e09..80bdfea 100644 --- a/src/oceanic_atom2.c +++ b/src/oceanic_atom2.c @@ -668,12 +668,12 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream status = dc_iostream_set_dtr(device->iostream, 1); if (status != DC_STATUS_SUCCESS) { ERROR (context, "Failed to set the DTR line."); - return status; + goto error_free; } status = dc_iostream_set_rts(device->iostream, 1); if (status != DC_STATUS_SUCCESS) { ERROR (context, "Failed to set the DTR line."); - return status; + goto error_free; } // Make sure everything is in a sane state.