From 4b54c4920327f08d5faae4d55a5dec6c963dfd09 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Mon, 6 Feb 2023 22:46:38 +0700 Subject: [PATCH] heap: fix gcc-12 compile errors --- components/heap/test_apps/main/test_realloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/heap/test_apps/main/test_realloc.c b/components/heap/test_apps/main/test_realloc.c index 9a25d4fbfa..17f293bc6b 100644 --- a/components/heap/test_apps/main/test_realloc.c +++ b/components/heap/test_apps/main/test_realloc.c @@ -20,10 +20,11 @@ TEST_CASE("realloc shrink buffer in place", "[heap]") { - void *x = malloc(64); + // pointers converted to int to avoid warning -Wuse-after-free + int x = (int) malloc(64); TEST_ASSERT(x); - void *y = realloc(x, 48); - TEST_ASSERT_EQUAL_PTR(x, y); + int y = (int) realloc((void *) x, 48); + TEST_ASSERT_EQUAL_UINT32((uint32_t) x, (uint32_t) y); } #endif