From a4e3ccd6abb97d05121635112bdca44fc0e440b0 Mon Sep 17 00:00:00 2001 From: "Anthony J. Bentley" Date: Fri, 26 Apr 2013 19:01:52 -0600 Subject: Don't use the nonportable alloca() during tests. --- test/cscodec-utf8.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/cscodec-utf8.c') diff --git a/test/cscodec-utf8.c b/test/cscodec-utf8.c index c36961e..6b1d4de 100644 --- a/test/cscodec-utf8.c +++ b/test/cscodec-utf8.c @@ -180,7 +180,7 @@ void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; - uint8_t *dest = alloca(destlen); + uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; @@ -196,7 +196,7 @@ void run_test(line_ctx *ctx) &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; - uint8_t *temp = alloca(templen); + uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; @@ -220,6 +220,8 @@ void run_test(line_ctx *ctx) assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } + + free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); @@ -242,5 +244,7 @@ void run_test(line_ctx *ctx) assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); + + free(dest); } -- cgit v1.2.3