]> sigrok.org Git - sigrok-cli.git/blobdiff - sigrok-cli.c
parserc.c: Fix memory leak from g_strsplit
[sigrok-cli.git] / sigrok-cli.c
index 93738c4de908956ded5ce4942878251d1b2434d9..70d3a59ee6cc2c3517c21baa84469619a129e255 100644 (file)
@@ -140,6 +140,12 @@ static GSList *hash_to_hwopt(GHashTable *hash)
        return opts;
 }
 
+static void free_hwopt(struct sr_hwopt *hwopt)
+{
+       g_free((void *)hwopt->value);
+       g_free(hwopt);
+}
+
 static GSList *device_scan(void)
 {
        struct sr_dev_driver **drivers, *driver;
@@ -174,6 +180,7 @@ static GSList *device_scan(void)
                                /* Unknown options, already logged. */
                                return NULL;
                devices = sr_driver_scan(driver, drvopts);
+               g_slist_free_full(drvopts, (GDestroyNotify)free_hwopt);
        } else {
                /* No driver specified, let them all scan on their own. */
                devices = NULL;
@@ -440,7 +447,7 @@ static void show_dev_detail(void)
                                printf("      %s\n", stropts[i]);
 
                } else if (hwo->hwcap == SR_HWCAP_FILTER) {
-                       /* Supported trigger sources */
+                       /* Supported filters */
                        printf("    %s", hwo->shortname);
                        if (sr_info_get(sdi->driver, SR_DI_FILTERS,
                                        (const void **)&stropts, sdi) != SR_OK) {