hantek-6xxx: fix memory leaks

Free the first flush packet and the driver context when closing.
This commit is contained in:
Benjamin Larsson 2016-04-12 23:47:34 +02:00 committed by Uwe Hermann
parent 2c4600191b
commit 5954e71653
1 changed files with 3 additions and 0 deletions

View 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));