]> sigrok.org Git - libsigrok.git/commitdiff
ftdi-la: Properly cleanup in scan_all()
authorLars-Peter Clausen <redacted>
Fri, 29 Apr 2016 16:07:54 +0000 (18:07 +0200)
committerLars-Peter Clausen <redacted>
Tue, 3 May 2016 19:22:38 +0000 (21:22 +0200)
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 <redacted>
src/hardware/ftdi-la/api.c

index 2cea73ea1cd62a05121d364d759223805412737c..144279851e29567dc0a9edd485b3fab7069cd250 100644 (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: