6 ms·
Why is double free so commonly an issue? Isn't setting to Null after free and checking for Null before hand a common practice?
by viperscape 9y ago
Why is double free so commonly an issue? Isn't setting to Null after free and checking for Null before hand a common practice?
- sidlls 9y agoIt isn't that common. On HN, however, you'd think there isn't a piece of software written in C that isn't responsible for mayhem and death. The sort of FUD around the language, driven helpfully by the Rust Evangelism Strikeforce, isn't helpful.
- tene 9y agoIt's usually not calling free() on the same variable within a single function, although that can sometimes happen. The most common case, I expect, is when two separate data structures both have pointers to the same object and believe they own it, then later end up calling free on the same address at different times.