From: Benjamin Larsson Date: Tue, 12 Apr 2016 21:47:34 +0000 (+0200) Subject: hantek-6xxx: fix memory leaks X-Git-Tag: libsigrok-0.5.0~496 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5954e71653132626c8995c2bfbbea46605027d8c;p=libsigrok.git hantek-6xxx: fix memory leaks Free the first flush packet and the driver context when closing. --- diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index 40b48a4b..480eb1c4 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -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));