]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Fix double-free issue.
authorMathias Katzer <redacted>
Sun, 11 Jan 2015 00:39:41 +0000 (01:39 +0100)
committerUwe Hermann <redacted>
Sun, 11 Jan 2015 00:43:12 +0000 (01:43 +0100)
src/hardware/hameg-hmo/protocol.c

index 6f5c0500f00413f5e7d4163db224ac8e7ea4d573..9487bac490c9c26dfeb3e35b1233c30c6568486b 100644 (file)
@@ -672,6 +672,8 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
 
        (void)fd;
 
+       data = NULL;
+
        if (!(sdi = cb_data))
                return TRUE;
 
@@ -704,6 +706,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
                        sr_session_send(cb_data, &packet);
                        g_slist_free(analog.channels);
                        g_array_free(data, TRUE);
+                       data = NULL;
                        break;
                case SR_CHANNEL_LOGIC:
                        if (sr_scpi_get_uint8v(sdi->conn, NULL, &data) != SR_OK) {
@@ -722,6 +725,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
                        packet.payload = &logic;
                        sr_session_send(cb_data, &packet);
                        g_array_free(data, TRUE);
+                       data = NULL;
                        break;
                default:
                        sr_err("Invalid channel type.");