From c95e8553ef4761f145b51ebc9997bcfa8def48b4 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 16 Sep 2022 08:12:22 +0200 Subject: [PATCH] tests/heap_cmd: fix -Wuse-after-free Strictly speaking, this is not actually a use after free, as only the address of the freed memory chunk is printed. The freed memory is not accesses. However, this is more idiomatic this way. --- tests/heap_cmd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/heap_cmd/main.c b/tests/heap_cmd/main.c index 7aa4c540135e..8fb24e4520f5 100644 --- a/tests/heap_cmd/main.c +++ b/tests/heap_cmd/main.c @@ -43,8 +43,8 @@ static int free_cmd(int argc, char **argv) unsigned int p = strtoul(argv[1], NULL, 16); void *ptr = (void *)p; + printf("freeing %p\n", ptr); free(ptr); - printf("freed %p\n", ptr); return 0; }