]> sigrok.org Git - libsigrok.git/commitdiff
hantek-6xxx: fix memory leaks
authorBenjamin Larsson <redacted>
Tue, 12 Apr 2016 21:47:34 +0000 (23:47 +0200)
committerUwe Hermann <redacted>
Sat, 23 Apr 2016 15:37:45 +0000 (17:37 +0200)
Free the first flush packet and the driver context when closing.

src/hardware/hantek-6xxx/api.c

index 40b48a4bff14ffbcf7f8da1b6b1e4676e17a3853..480eb1c4f8aed4e5e8381a69d336b155198a9ec1 100644 (file)
@@ -155,6 +155,7 @@ static void clear_dev_context(void *priv)
 
        devc = priv;
        g_slist_free(devc->enabled_channels);
+       g_free(devc);
 }
 
 static int dev_clear(const struct sr_dev_driver *di)
@@ -650,6 +651,8 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
        devc = sdi->priv;
 
        if (devc->dev_state == FLUSH) {
+               g_free(transfer->buffer);
+               libusb_free_transfer(transfer);
                devc->dev_state = CAPTURE;
                devc->aq_started = g_get_monotonic_time();
                read_channel(sdi, data_amount(sdi));