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 fix this let the dev_clear() free the additional data. Signed-off-by: Lars-Peter Clausen <[email protected]> --- src/hardware/scpi-pps/api.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index a29744e..dbe8dcb 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -181,11 +181,6 @@ static GSList *dev_list(const struct sr_dev_driver *di) return ((struct drv_context *)(di->context))->instances; } -static int dev_clear(const struct sr_dev_driver *di) -{ - return std_dev_clear(di, NULL); -} - static int dev_open(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -248,11 +243,16 @@ static void clear_helper(void *priv) g_free(devc); } -static int cleanup(const struct sr_dev_driver *di) +static int dev_clear(const struct sr_dev_driver *di) { return std_dev_clear(di, clear_helper); } +static int cleanup(const struct sr_dev_driver *di) +{ + return dev_clear(di); +} + static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { -- 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

