Skip to content

Commit c95e855

Browse files
committed
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.
1 parent a04b0a0 commit c95e855

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/heap_cmd/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static int free_cmd(int argc, char **argv)
4343

4444
unsigned int p = strtoul(argv[1], NULL, 16);
4545
void *ptr = (void *)p;
46+
printf("freeing %p\n", ptr);
4647
free(ptr);
47-
printf("freed %p\n", ptr);
4848
return 0;
4949
}
5050

0 commit comments

Comments
 (0)