NULL pointer dereferenced
This defect occurs when you
use a pointer with a value of NULL as if it points
to a valid memory location.
Dereferencing a null pointer is undefined behavior. In most implementations, the dereference can cause your program to crash.
Check a pointer for NULL before dereference.
If the issue occurs despite an earlier check
for NULL, look for intermediate events between the check and the
subsequent dereference. Often the result details show a sequence of events that led
to the defect. You can implement the fix on any event in the sequence. If the result
details do not show the event history, you can trace back using right-click options
in the source code and see previous related events. See also Interpret Bug Finder Results in Polyspace Desktop User Interface.
See examples of fixes below.
| Group: Static memory |
| Language: C | C++ |
| Default: On |
Command-Line Syntax: NULL_PTR |
| Impact: High |
| CWE ID: 476, 690 |