In this section:
This problem occurs when an attempt is made to dereference a pointer that points to a block of memory that has been freed.
Code Description Enabled Reported Platform WRITE_DANGLING Writing to a dangling pointer Runtime Windows/Unix
The following code attempts to use a piece of dynamically allocated memory after it has already been freed.
Diagnosis at Runtime
- Line 2: Source line at which the problem was detected.
- Line 3: Description of the problem and the expression that is in error.
- Line 4: Value of the dangling pointer variable.
- Line 5: Description of the block to which this pointer used to point, including its size, name, and the line at which it was allocated.
- Line 9: Indication of the line at which this block was freed.
- Line 11: Stack trace showing the function call sequence leading to the error.
Check that the de-allocation that occurs at the indicated location should indeed have taken place. Also check that the pointer you are using should really be pointing to a block allocated at the indicated place.