]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Use g_byte_array_free() instead of g_free().
authorGuido Trentalancia <redacted>
Fri, 16 Nov 2018 17:38:54 +0000 (18:38 +0100)
committerUwe Hermann <redacted>
Thu, 25 Jul 2019 22:10:35 +0000 (00:10 +0200)
Use the appropriate glib function to free memory (byte array).

This fixes bug #1324.

src/hardware/hameg-hmo/protocol.c

index 059ae4399cc612f241b6b5d0dff7e3e1f9ec6994..f534cb4705c07042dfbeb5da562870a950c5f990 100644 (file)
@@ -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;
                }