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.
This commit is contained in:
parent
d3cff734e5
commit
fabe59b326
|
@ -385,6 +385,7 @@ static int clear_instances(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hw_dev_close(sdi);
|
hw_dev_close(sdi);
|
||||||
|
sr_usb_dev_inst_free(devc->usb);
|
||||||
sdi = l->data;
|
sdi = l->data;
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,6 +422,7 @@ static int hw_cleanup(void)
|
||||||
switch (devc->profile->transport) {
|
switch (devc->profile->transport) {
|
||||||
case DMM_TRANSPORT_USBHID:
|
case DMM_TRANSPORT_USBHID:
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
sr_usb_dev_inst_free(devc->usb);
|
||||||
break;
|
break;
|
||||||
case DMM_TRANSPORT_SERIAL:
|
case DMM_TRANSPORT_SERIAL:
|
||||||
if (devc->serial && devc->serial->fd != -1)
|
if (devc->serial && devc->serial->fd != -1)
|
||||||
|
|
|
@ -232,10 +232,17 @@ static void clear_instances(void)
|
||||||
GSList *l;
|
GSList *l;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
|
struct dev_context *devc;
|
||||||
|
|
||||||
drvc = zdi->priv;
|
drvc = zdi->priv;
|
||||||
for (l = drvc->instances; l; l = l->next) {
|
for (l = drvc->instances; l; l = l->next) {
|
||||||
sdi = l->data;
|
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... */
|
/* Properly close all devices... */
|
||||||
hw_dev_close(sdi);
|
hw_dev_close(sdi);
|
||||||
/* ...and free all their memory. */
|
/* ...and free all their memory. */
|
||||||
|
|
Loading…
Reference in New Issue