From: Bert Vermeulen Date: Sat, 4 Aug 2012 10:21:02 +0000 (+0200) Subject: sr: drivers using sr_usb_dev_inst_new() must free it properly as well X-Git-Tag: dsupstream~729 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=fabe59b326c8ed17582f54d5525b278b6712085b;p=libsigrok.git sr: drivers using sr_usb_dev_inst_new() must free it properly as well sr_usb_dev_inst_free() doesn't really do anything, but it might one day. --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index a6817340..b05334a3 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -385,6 +385,7 @@ static int clear_instances(void) continue; } hw_dev_close(sdi); + sr_usb_dev_inst_free(devc->usb); sdi = l->data; sr_dev_inst_free(sdi); } diff --git a/hardware/genericdmm/api.c b/hardware/genericdmm/api.c index 5c868a4d..42136017 100644 --- a/hardware/genericdmm/api.c +++ b/hardware/genericdmm/api.c @@ -422,6 +422,7 @@ static int hw_cleanup(void) switch (devc->profile->transport) { case DMM_TRANSPORT_USBHID: /* TODO */ + sr_usb_dev_inst_free(devc->usb); break; case DMM_TRANSPORT_SERIAL: if (devc->serial && devc->serial->fd != -1) diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 94ce37e1..7dcda9cf 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -232,10 +232,17 @@ static void clear_instances(void) GSList *l; struct sr_dev_inst *sdi; struct drv_context *drvc; + struct dev_context *devc; drvc = zdi->priv; for (l = drvc->instances; l; l = l->next) { sdi = l->data; + if (!(devc = sdi->priv)) { + /* Log error, but continue cleaning up the rest. */ + sr_err("zeroplus: %s: sdi->priv was NULL, continuing", __func__); + continue; + } + sr_usb_dev_inst_free(devc->usb); /* Properly close all devices... */ hw_dev_close(sdi); /* ...and free all their memory. */