I seem to be having a problem with my destructor and/or with freeing allocated memory. Here's my simple code:
void* Init(){
try {
Facebook* DS = new Facebook();
return (void*)DS;
} catch(std::bad_alloc&) {
return NULL;
}
}
and here's the function releasing the memory allocated by this function:
void Quit(void** DS){
delete (Facebook*)DS;
*DS = NULL;
return;
}
if im simply calling only these 2 functions im getting an invalid delete at the line of the delete, and the memory allocated by the new was lost.
here's the facebook class:
class Facebook {
private:
List<Troll*> trollsList;
AVLTree<PostByLikes> likesTree;
AVLTree<PostById> idTree;
int maxPost;
}
and there's no allocating memory being made in the constructor of this class...