[asterisk-dev] [Code Review]: automagically set a pointer to null after it is freed with ast_free
benny+usenet at amorsen.dk
Tue Sep 20 08:00:30 CDT 2011
"Kevin P. Fleming" <kpfleming at digium.com> writes:
> We have had similar discussions about pointers to astobj2 reference
> counted objects; it has been my opinion since we introduced astobj2
> that releasing a reference to an object should clear the pointer that
> held the reference (although the code still does not actually do
If you use a value in the zero page which isn't actually NULL (e.g. 1 or
4095), you catch both double-free and use-after-free.
The downside is that you lose the value of the pointer which can be
inconvenient for valgrind. The same applies to using NULL of course.
More information about the asterisk-dev