what's wrong with this code?

CMyClass *pointer = (CMyClass*)SomeThing

...do stuff with pointer


// Done with pointer
delete[] pointer

i get a memory leak without deleting it and i get an access
violation with it

any ideas?