delete operates on a void* pointer
pointing to an object
This defect occurs
when the delete operator operates on a void* pointer.
Deleting a void* pointer is undefined according
to the C++ Standard.
If the object is of type MyClass and the delete operator
operates on a void* pointer pointing to the object,
the MyClass destructor is not called.
If the destructor contains cleanup operations such as release of resources or decreasing a counter value, the operations do not take place.
Cast the void* pointer to the appropriate
type. Perform the delete operation on the result
of the cast.
For instance, if the void* pointer points
to a MyClass object, cast the pointer to MyClass*.
| Group: Good practice |
| Language: C++ |
| Default: Off |
Command-Line Syntax: DELETE_OF_VOID_PTR |
| Impact: Low |