ftdi-la: Properly cleanup in scan_all()

Make sure to free the FTDI device list and the FTDI context in scan_all()
otherwise memory leaks can be observed. Also make sure to free the FTDI
context in scan_device() on the error path.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2016-04-29 18:07:54 +02:00
parent 61c9085898
commit 7b6072d354
1 changed files with 4 additions and 0 deletions

View File

@ -172,6 +172,7 @@ err_free_strings:
g_free(vendor);
g_free(model);
g_free(serial_num);
ftdi_free(devc->ftdic);
err_free_data_buf:
g_free(devc->data_buf);
g_free(devc);
@ -211,6 +212,9 @@ static GSList *scan_all(struct sr_dev_driver *di, GSList *options)
curdev = curdev->next;
}
ftdi_list_free(&devlist);
ftdi_free(ftdic);
return devices;
err_free_ftdic: