From: Guido Trentalancia Date: Fri, 16 Nov 2018 17:38:54 +0000 (+0100) Subject: hameg-hmo: Use g_byte_array_free() instead of g_free(). X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=14cb6aa40a26e12f24a28c66e6a8d6ba636c6281 hameg-hmo: Use g_byte_array_free() instead of g_free(). Use the appropriate glib function to free memory (byte array). This fixes bug #1324. --- diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 059ae439..f534cb47 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -881,7 +881,6 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data) if (sr_scpi_get_block(sdi->conn, NULL, &data) != SR_OK) { if (data) g_byte_array_free(data, TRUE); - return TRUE; } @@ -927,7 +926,8 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data) break; case SR_CHANNEL_LOGIC: if (sr_scpi_get_block(sdi->conn, NULL, &data) != SR_OK) { - g_free(data); + if (data) + g_byte_array_free(data, TRUE); return TRUE; }