better buffer size calculation

This commit is contained in:
Bert Vermeulen 2010-04-08 16:42:22 +02:00
parent d2cd86ac26
commit 37aea2d35c
1 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ static int data_binary(struct output *o, char *data_in, uint64_t length_in, char
char *outbuf;
ctx = o->internal;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * 3 + 512;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * ctx->samples_per_line + 512;
outbuf = calloc(1, outsize+1);
if(ctx->header) {
/* the header is still in here, we must be on the first data packet */
@ -213,7 +213,7 @@ static int data_hex(struct output *o, char *data_in, uint64_t length_in, char **
char *outbuf;
ctx = o->internal;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * 3 + 512;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * ctx->samples_per_line + 512;
outbuf = calloc(1, outsize+1);
if(ctx->header) {
/* the header is still in here, we must be on the first data packet */