/** @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)
{
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);
{
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))
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);
}