From: Bartosz Golaszewski Date: Wed, 18 Mar 2015 13:26:43 +0000 (+0100) Subject: baylibre-acme: Fix a double free in bl_acme_set_shunt(). X-Git-Tag: libsigrok-0.4.0~590 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=350b8b07f0d84653c0e8bbb4ef61d670d24e7c2a baylibre-acme: Fix a double free in bl_acme_set_shunt(). Signed-off-by: Bartosz Golaszewski --- diff --git a/src/hardware/baylibre-acme/protocol.c b/src/hardware/baylibre-acme/protocol.c index 461a7b5e..8769eefe 100644 --- a/src/hardware/baylibre-acme/protocol.c +++ b/src/hardware/baylibre-acme/protocol.c @@ -328,11 +328,10 @@ SR_PRIV int bl_acme_set_shunt(const struct sr_channel_group *cg, uint64_t shunt) fd = g_fopen(path->str, "w"); if (!fd) { sr_err("Error opening %s: %s", path->str, strerror(errno)); - g_string_free(path, TRUE); - return SR_ERR_IO; + ret = SR_ERR_IO; + goto out; } - g_string_free(path, TRUE); g_fprintf(fd, "%" PRIu64 "\n", MOHM_TO_UOHM(shunt)); fclose(fd);