Fix issue with optional PD probes.
authorUwe Hermann <uwe@hermann-uwe.de>
Sun, 8 Sep 2013 17:59:05 +0000 (19:59 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Sun, 8 Sep 2013 18:01:31 +0000 (20:01 +0200)
Running (or showing info about) PDs with optional probes was not working
and causing segfaults.

The reason was a g_slist_concat() call that was applied to a list,
whereas it needs to be applied to a copy of the list.

This fixes #138.

sigrok-cli.c

index 71c35b78d359c83e118fc8b7b72635f59d6da668..8521b9546128d17ff2c4f5fa5cae259d7d41d1a8 100644 (file)
@@ -1014,7 +1014,7 @@ static int probes_to_gvar(struct srd_decoder *dec, GHashTable *hash,
                        (GDestroyNotify)g_variant_unref);
 
        all_probes = g_slist_copy(dec->probes);
-       all_probes = g_slist_concat(all_probes, dec->opt_probes);
+       all_probes = g_slist_concat(all_probes, g_slist_copy(dec->opt_probes));
        for (l = all_probes; l; l = l->next) {
                p = l->data;
                if (!(val_str = g_hash_table_lookup(hash, p->id)))