I have an object that I’m freeing with delete, and it has a char* that’s being freed with free in its destructor. The reason I’m using free is because I used strdup and malloc in creating the char pointers. The reason I’m using malloc is because I used strdup to begin with in most code paths. Would this scenario cause memory corruption?
I have an object that I’m freeing with delete, and it has a char*
Share
No, if you match calls properly i.e.
free()for memory allocated withmalloc()anddeletefor memory allocated withnew, it will work fine.