output_text: Allocate enough memory for output

This commit is contained in:
Håvard Espeland 2011-01-15 16:10:57 +01:00
parent 858fb11c5e
commit 3aa403e858
1 changed files with 2 additions and 2 deletions

View File

@ -194,8 +194,8 @@ 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 = length_in / ctx->unitsize * ctx->num_enabled_probes
/ ctx->samples_per_line * max_linelen + 512;
outsize = (1 + (length_in / ctx->unitsize) / ctx->samples_per_line)
* (ctx->num_enabled_probes * max_linelen);
if (!(outbuf = calloc(1, outsize + 1)))
return SIGROK_ERR_MALLOC;