Skip to content

Commit

Permalink
tests/heap_cmd: fix -Wuse-after-free
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maribu committed Sep 16, 2022
1 parent a04b0a0 commit c95e855
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/heap_cmd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c95e855

Please sign in to comment.