News for hackers. Stuff that matters.
Re:Let’s Stop Bashing C by Kenji on Friday December 02, 2016 @12:11PM (#13090345)
not to use after free(); accidentally adding a second clause to a non-bracketed if expression;

Two methods I religiously use in my code: Set to NULL after freeing. free(NULL) is a no op, so freeing twice is never an issue anymore. And since you probably won't use the variable after that anyway, setting it to NULL eventually gets optimized out anyway, probably. And no if without brackets in my codebase.

There are no comments on this comment yet.