diff --git a/src/device.c b/src/device.c index 3d9cbf8f..051616f5 100644 --- a/src/device.c +++ b/src/device.c @@ -242,7 +242,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int status, /** @private * Free device instance struct created by sr_dev_inst(). - * @param sdi struct* to free. + * @param sdi device instance to free. */ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) { @@ -260,7 +260,10 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) for (l = sdi->channel_groups; l; l = l->next) { cg = l->data; + g_free(cg->name); + g_slist_free(cg->channels); g_free(cg->priv); + g_free(cg); } g_slist_free(sdi->channel_groups); diff --git a/src/std.c b/src/std.c index 7d78578d..fed47feb 100644 --- a/src/std.c +++ b/src/std.c @@ -249,8 +249,7 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, { struct drv_context *drvc; struct sr_dev_inst *sdi; - struct sr_channel_group *cg; - GSList *l, *lcg; + GSList *l; int ret; if (!(drvc = driver->priv)) @@ -285,13 +284,6 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, else 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); }