]> sigrok.org Git - libsigrok.git/commitdiff
output/csv: fix segfault when naming logic channels
authorWolfram Sang <redacted>
Thu, 11 May 2017 11:51:07 +0000 (13:51 +0200)
committerUwe Hermann <redacted>
Sat, 13 May 2017 20:33:54 +0000 (22:33 +0200)
'j' is the loop variable for channels, not 'i'.

This fixes parts of bug #844.

Reported-by: Maxim Sloyko <redacted>
Signed-off-by: Wolfram Sang <redacted>
src/output/csv.c

index 402ab904454c69cc0669d1152ad1810a6ad4dc8f..97102f45917482ee002e75caabe33754bcdfc0c3 100644 (file)
@@ -382,7 +382,7 @@ static void process_logic(struct context *ctx,
                                sample = logic->data + i;
                                idx = ctx->channels[ch].ch->index;
                                if (ctx->label_do && !ctx->label_names)
-                                       ctx->channels[i].label = "logic";
+                                       ctx->channels[j].label = "logic";
                                ctx->logic_samples[i * ctx->num_logic_channels + ch] = sample[idx / 8] & (1 << (idx % 8));
                        }
                        ch++;