X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Foutput%2Fcsv.c;h=848595f9d3096b9570fcd0e5505e2d1026ea1250;hb=d8fbfcd9d6d66bffcb8607e9de7706ce322d42c7;hp=49d6eb6ec457ea2b211aaab4e897cbd72ce4566c;hpb=ce384e074f41685bad83c3cef10ea1d635a2834d;p=libsigrok.git diff --git a/src/output/csv.c b/src/output/csv.c index 49d6eb6e..848595f9 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -420,7 +420,8 @@ static void dump_saved_values(struct context *ctx, GString **out) } else { sr_info("Dumping %u samples", ctx->num_samples); - *out = g_string_sized_new(512); + if (!*out) + *out = g_string_sized_new(512); num_channels = ctx->num_logic_channels + ctx->num_analog_channels; @@ -678,6 +679,7 @@ static int receive(const struct sr_output *o, ctx->trigger = TRUE; break; case SR_DF_LOGIC: + *out = g_string_sized_new(512); logic = packet->payload; ctx->pkt_snums = logic->length; ctx->pkt_snums /= logic->length; @@ -685,6 +687,7 @@ static int receive(const struct sr_output *o, process_logic(ctx, logic); break; case SR_DF_ANALOG: + *out = g_string_sized_new(512); analog = packet->payload; ctx->pkt_snums = analog->num_samples; ctx->pkt_snums /= g_slist_length(analog->meaning->channels);