std: Free channel groups from device instances as well.
This commit is contained in:
parent
07443fd204
commit
886413b6d2
13
src/std.c
13
src/std.c
|
@ -249,7 +249,8 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
GSList *l;
|
struct sr_channel_group *cg;
|
||||||
|
GSList *l, *lcg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(drvc = driver->priv))
|
if (!(drvc = driver->priv))
|
||||||
|
@ -278,9 +279,19 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
|
||||||
sr_scpi_free(sdi->conn);
|
sr_scpi_free(sdi->conn);
|
||||||
}
|
}
|
||||||
if (clear_private)
|
if (clear_private)
|
||||||
|
/* The helper function is responsible for freeing
|
||||||
|
* its own sdi->priv! */
|
||||||
clear_private(sdi->priv);
|
clear_private(sdi->priv);
|
||||||
else
|
else
|
||||||
g_free(sdi->priv);
|
g_free(sdi->priv);
|
||||||
|
|
||||||
|
/* Channel groups */
|
||||||
|
for (lcg = sdi->channel_groups; lcg; lcg = lcg->next) {
|
||||||
|
cg = lcg->data;
|
||||||
|
g_free(cg->name);
|
||||||
|
g_slist_free(cg->channels);
|
||||||
|
g_free(cg);
|
||||||
|
}
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue