I have an array in C++:
Player ** playerArray;
which is initialized in the constructor of the class it is in.
In the destructor I
I think what valgrind is warning about is that the delete is occuring in the context of something like this:
int foo(void *mydata){
{
SomeClass some_value = static_cast mydata;
some_value.dosomething();
// now we're done with it
delete mydata;
}
although the cast is fine, since you happen to know that the void pointer is actually that type, you're still doing something fishy, because you're deleting the void pointer, rather than the typed pointer. If SomeClass is POD, that's probably ok, but if it has some critical work it must do in its destructor, that destructor never gets called.