From: HÃ¥vard Espeland Date: Sat, 15 Jan 2011 17:24:01 +0000 (+0100) Subject: output_text: Allocate more memory for output X-Git-Tag: libsigrok-0.1.0~426 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9d7ab9ba3b5208e99bc7fd33c6a831fe21a427f3;p=libsigrok.git output_text: Allocate more memory for output The trigger line was forgotten. Allocate 512 bytes extra. --- diff --git a/output/output_text.c b/output/output_text.c index 6e2d4f08..03eac777 100644 --- a/output/output_text.c +++ b/output/output_text.c @@ -194,7 +194,11 @@ static int data_bits(struct output *o, char *data_in, uint64_t length_in, ctx = o->internal; max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + ctx->samples_per_line / 8; - outsize = (1 + (length_in / ctx->unitsize) / ctx->samples_per_line) + /* + * Calculate space needed for probes. Set aside 512 bytes for + * extra output, e.g. trigger. + */ + outsize = 512 + (1 + (length_in / ctx->unitsize) / ctx->samples_per_line) * (ctx->num_enabled_probes * max_linelen); if (!(outbuf = calloc(1, outsize + 1)))