From 14cb6aa40a26e12f24a28c66e6a8d6ba636c6281 Mon Sep 17 00:00:00 2001 From: Guido Trentalancia Date: Fri, 16 Nov 2018 18:38:54 +0100 Subject: [PATCH] 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. --- src/hardware/hameg-hmo/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }