...
The tool Compass Rose is able to detect violations of this rule. In particular, Rose ensures that any pointer returned by malloc()
, calloecalloc()
, or realloc()
is first checked for NULL before otherwise used (or else it is {{free()}}d. Rose doesn't handle cases where an allocation is assigned to an lvalue that is not a variable (such as a struct member or C++ function call returning a reference.)
...