[sigrok-devel] [PATCH 5/9] deree-de5000: Provide dev_clear()

2016-04-29 Thread Lars-Peter Clausen
Devices for the deree-de5000 driver do have additional data attached to it that needs to be freed when the device is freed. While the driver gets it right for the cleanup() callback it does not implement a dev_clear() callback, so the default dev_clear() implementation is used which will not free t

[sigrok-devel] [PATCH 7/9] Introduce standard cleanup helper

2016-04-29 Thread Lars-Peter Clausen
std_init() allocates a drv_context struct which needs to be freed by the driver in its cleanup struct. But the vast majority of drivers does never does this causing memory leaks. Instead of addressing the issue by manually adding code to free the struct to each driver introduce a new helper functi

[sigrok-devel] [PATCH 9/9] Introduce standard implementation of the dev_list callback

2016-04-29 Thread Lars-Peter Clausen
Every single hardware driver has the very same implementation of the dev_list() callback. Put this into a helper function in the standard helper library and use it throughout the drivers. This reduces boiler-plate code by quite a bit. Signed-off-by: Lars-Peter Clausen --- src/hardware/agilent-dm

[sigrok-devel] [PATCH 0/9] Memory leak fixes and boiler-plate code reduction

2016-04-29 Thread Lars-Peter Clausen
Hi, This series fixes a large set of memory leaks that can be observed when scanning for devices. Some of these leaks are driver specific and are fixed in their respective drivers. But there is also one leak that is systematic. Most drivers fail to free the drv_context struct that is allocated in

[sigrok-devel] [PATCH 3/9] beaglelogic: Use std_dev_clear() instead of open-coding it

2016-04-29 Thread Lars-Peter Clausen
The beaglelogic has an open-coded version of std_dev_clear(), replace it with std_dev_clear(). Signed-off-by: Lars-Peter Clausen --- src/hardware/beaglelogic/api.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/hardware/beaglelogic/api.c b/src/hardwa

[sigrok-devel] [PATCH 6/9] scpi-pps: Fix dev_clear() implementation

2016-04-29 Thread Lars-Peter Clausen
Devices for the scpi-pps driver do have additional data attached to it that needs to be freed when the device is freed. While the driver gets it right for the cleanup() callback it does not for the dev_clear() callback. This will cause memory leaks when sr_dev_clear() is called for this driver. To

[sigrok-devel] [PATCH 8/9] Remove unnecessary dev_clear() callbacks

2016-04-29 Thread Lars-Peter Clausen
If a driver does not implement a dev_clear() callback the core will automatically call std_dev_clear(di, NULL). Remove all driver dev_clear() implementations that are identical to default. This reduces the amount of boiler-plate code. Signed-off-by: Lars-Peter Clausen --- src/hardware/arachnid-l

[sigrok-devel] [PATCH 4/9] demo: Provide dev_clear()

2016-04-29 Thread Lars-Peter Clausen
Devices for the demo driver do have additional data attached to it that needs to be freed when the device is freed. While the driver gets it right for the cleanup() callback it does not implement a dev_clear() callback, so the default dev_clear() implementation is used which will not free the addit

[sigrok-devel] [PATCH 2/9] baylibre-acme: Properly free GErrors returned by g_file_get_contents()

2016-04-29 Thread Lars-Peter Clausen
When g_file_get_contents() encounters an error a new GError will be allocated and passed back to the application. The application is responsible for freeing this GError. The baylibre-acme driver currently does not do this and as a result leaks memory during the scan process when no device is found

[sigrok-devel] [PATCH 1/9] ftdi-la: Properly cleanup in scan_all()

2016-04-29 Thread Lars-Peter Clausen
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 --- src/hardware/ftdi-la/api.c | 4 1 file changed, 4 insertions(+)

Re: [sigrok-devel] Git pull/review request

2016-04-29 Thread Aurelien Jacobs
On Sun, Apr 24, 2016 at 03:46:17PM +0200, Stefan Bruens wrote: > Hi folks, > > another round of patches, available at: > > https://github.com/StefanBruens/libsigrok.git for_upstream_20160424 > > [...] > > [3] The equality check is exact, but requires int64 -> __int_128 > multiplication. This is