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 <[email protected]>
---
 src/hardware/ftdi-la/api.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c
index 68d60e0..4657562 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:
-- 
2.1.4


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to