...
The tool Compass Rose is able to detect violations of this rule. In particular, Rose ensures that any pointer returned by malloc()
, calloc()
, or realloc()
is first checked for NULL before otherwise being used (or else otherwise 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.)
...