]> sigrok.org Git - libsigrok.git/commitdiff
sr: properly free probes when freeing their device instance
authorBert Vermeulen <redacted>
Sat, 4 Aug 2012 10:03:05 +0000 (12:03 +0200)
committerBert Vermeulen <redacted>
Sat, 4 Aug 2012 10:03:05 +0000 (12:03 +0200)
device.c

index e9f6c7bcdd661a644221acbd07e5b43804b56365..cbb3853443041c6a4b1316e9907763d944faa8f9 100644 (file)
--- a/device.c
+++ b/device.c
@@ -209,11 +209,21 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
 
 SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
 {
+       struct sr_probe *probe;
+       GSList *l;
+
+       for (l = sdi->probes; l; l = l->next) {
+               probe = l->data;
+               g_free(probe->name);
+               g_free(probe);
+       }
+
        g_free(sdi->priv);
        g_free(sdi->vendor);
        g_free(sdi->model);
        g_free(sdi->version);
        g_free(sdi);
+
 }
 
 #ifdef HAVE_LIBUSB_1_0