using the C++ delete operator
I have a module as shown below:
This memory had been previously allocated using the new operator.
void FreeMemory(void *mem)
When I was running a unit testing tool for this function, the program crashes on the delete operator. It actually passes a pointer which was not allocated previously using new operator.
I read that the new operator, gives an exception if it fails to allocate memory.
However, the delete operator does not raise an exception and simply crashes.
Now, how do I get around this problem and make sure the test case passes successfully ?