Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
htfy96
6y ago
0 comments
Save
Share
An example to detect use-after-free:
https://godbolt.org/z/zhiNLW
Basically this replicates what clang-tidy did
0 comments
3 comments · 1 top-level
top
newest
oldest
cornstalks
6y ago
· 2 in thread
Too bad it doesn't detect the mismatch between new and free.
peapicker
6y 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
6y ago
and if you fix the void->int, the warning goes away.
1 more reply
j
/
k
navigate · click thread line to collapse