Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
htfy96
5y ago
0 comments
Share
An example to detect use-after-free:
https://godbolt.org/z/zhiNLW
Basically this replicates what clang-tidy did
0 comments
default
newest
oldest
cornstalks
5y ago
Too bad it doesn't detect the mismatch between new and free.
peapicker
5y ago
And if you fix it to use delete instead of free, you get "can't delete void *" errors. Perhaps not the best example code.
gpderetta
5y ago
and if you fix the void->int, the warning goes away.
1 more reply
j
/
k
navigate · click thread line to collapse