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:
parent
61c9085898
commit
7b6072d354
|
@ -172,6 +172,7 @@ err_free_strings:
|
||||||
g_free(vendor);
|
g_free(vendor);
|
||||||
g_free(model);
|
g_free(model);
|
||||||
g_free(serial_num);
|
g_free(serial_num);
|
||||||
|
ftdi_free(devc->ftdic);
|
||||||
err_free_data_buf:
|
err_free_data_buf:
|
||||||
g_free(devc->data_buf);
|
g_free(devc->data_buf);
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
|
@ -211,6 +212,9 @@ static GSList *scan_all(struct sr_dev_driver *di, GSList *options)
|
||||||
curdev = curdev->next;
|
curdev = curdev->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ftdi_list_free(&devlist);
|
||||||
|
ftdi_free(ftdic);
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
|
|
||||||
err_free_ftdic:
|
err_free_ftdic:
|
||||||
|
|
Loading…
Reference in New Issue