]> sigrok.org Git - libsigrok.git/commitdiff
Free channel group private storage when clearing device instance.
authorBert Vermeulen <redacted>
Sat, 18 Oct 2014 21:09:47 +0000 (23:09 +0200)
committerBert Vermeulen <redacted>
Sat, 18 Oct 2014 21:21:37 +0000 (23:21 +0200)
src/device.c

index 2b6cda03bd9812a9969535c7792489d1bbe242e6..f3a76ac269b9a67a7f0f765a8e509d4138736663 100644 (file)
@@ -247,6 +247,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int status,
 SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
 {
        struct sr_channel *ch;
+       struct sr_channel_group *cg;
        GSList *l;
 
        for (l = sdi->channels; l; l = l->next) {
@@ -257,8 +258,11 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
        }
        g_slist_free(sdi->channels);
 
-       if (sdi->channel_groups)
-               g_slist_free(sdi->channel_groups);
+       for (l = sdi->channel_groups; l; l = l->next) {
+               cg = l->data;
+               g_free(cg->priv);
+       }
+       g_slist_free(sdi->channel_groups);
 
        g_free(sdi->vendor);
        g_free(sdi->model);