From: Lars-Peter Clausen Date: Fri, 29 Apr 2016 16:07:54 +0000 (+0200) Subject: ftdi-la: Properly cleanup in scan_all() X-Git-Tag: libsigrok-0.5.0~472 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7b6072d3546ebec08f4bc7861d985c667c55e02f;p=libsigrok.git 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 --- diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index 2cea73ea..14427985 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -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: