I have the following code:
void customHandleException (_EXCEPTION_POINTERS* ExceptionInfo)
{
char* x = (char*)ExceptionInfo->ExceptionRecord->ExceptionInformation[0];
delete[] x;
}
void foo()
{
char* x = new char[ 256 ];
ULONG_PTR* args = new ULONG_PTR[1];
args[0] = (long)x;
RaiseException(EXCEPTION_CODE,0,1,args);
}
Leaving all else aside, char* x
from customHandleException()
will point to the char array allocated in foo()
. Will this cause a memory leak or will the delete work?