In this section:
This error is generated if the null pointer is passed to a routine that de-allocates memory. Freeing null pointer
Code Description Enabled Reported Platform FREE_LOCAL Runtime Windows/Unix
Freeing null pointer
The following code attempts to free a null pointer:
Diagnosis at Runtime
- Line 2: Source file and line at which the problem was detected.
- Line 3: Description of the problem and the expression that is in error.
- Line 5: Stack trace showing the function call sequence leading to the error.
- Line 6: Informational message indicating that a serious error has occurred which may cause the program to crash.
The quick, simple solution is to add code to check whether the pointer is null before calling free(). Alternatively, check the stack trace. Doing so can lead to clues as to how the pointer was set to null in the first place, so that the error can be prevented from the root.