You get undefined behaviour if you try to delete
an object through a pointer more than once.
This means that pretty much anything can happen from ‘appearing to work’ to ‘crashing’ or something completely random.
More Related Contents:
- Is it safe to delete a NULL pointer?
- Avoid memory leaks in C++ Pointers [closed]
- C++ delete – It deletes my objects but I can still access the data?
- Is delete[] equal to delete?
- delete vs delete[] operators in C++
- Is “delete this” allowed in C++?
- Dynamically allocating an array of objects
- delete vs delete[] [duplicate]
- How does delete[] know it’s an array?
- Why doesn’t delete set the pointer to NULL?
- Determine the size of a C++ array programmatically?
- Is there any reason to check for a NULL pointer before deleting?
- How to know if a pointer points to the heap or the stack?
- Is the pointer guaranteed to preserve its value after `delete` in C++?
- Deleting a pointer in C++
- Does delete on a pointer to a subclass call the base class destructor?
- Pointer-to-pointer dynamic two-dimensional array
- Check if a pointer points to allocated memory on the heap
- Reason why not to have a DELETE macro for C++
- How to allocate a 2D array of pointers in C++
- Why, really, deleting an incomplete type is undefined behaviour?
- What do I need to do before deleting elements in a vector of pointers to dynamically allocated objects?
- The difference between delete and delete[] in C++ [duplicate]
- What happen to pointers when vectors need more memory and realocate memory?
- Passing a 2D array to a C++ function
- Why does cout print char arrays differently from other arrays?
- Can a pointer to base point to an array of derived objects?
- std::unique_ptr with derived class
- C++: difference between ampersand “&” and asterisk “*” in function/method declaration?
- Calling delete on NULL pointers – C++03 vs C++11