From: Jens Axboe Date: Fri, 1 Dec 2017 18:30:49 +0000 (-0700) Subject: memcpy: use malloc X-Git-Tag: fio-3.3~26 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2226ce346557b79b85de46e5bb47b9102f709180;p=fio.git memcpy: use malloc We don't have posix_memalign() everywhere, let's just use malloc. Also free memory when done. Signed-off-by: Jens Axboe --- diff --git a/lib/memcpy.c b/lib/memcpy.c index f937dd9f..8164ba09 100644 --- a/lib/memcpy.c +++ b/lib/memcpy.c @@ -187,9 +187,9 @@ static int setup_tests(void) void *src, *dst; int i; - if (posix_memalign(&src, page_size, BUF_SIZE)) - return 1; - if (posix_memalign(&dst, page_size, BUF_SIZE)) + src = malloc(BUF_SIZE); + dst = malloc(BUF_SIZE); + if (!src || !dst) return 1; init_rand_seed(&state, 0x8989, 0); @@ -204,6 +204,12 @@ static int setup_tests(void) return 0; } +static void free_tests(void) +{ + free(tests[0].src); + free(tests[0].dst); +} + int fio_memcpy_test(const char *type) { unsigned int test_mask = 0; @@ -259,5 +265,6 @@ int fio_memcpy_test(const char *type) } } + free_tests(); return 0; }