#include <Windows.h>
#include <iostream>
using namespace std;
int main(void)
{
unsigned char* pFoo = new unsigned char[1000];
pFoo = (unsigned char*)VirtualAlloc(NULL, 1000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
VirtualFree(pFoo, 0, MEM_RELEASE);
delete[] pFoo;
cin.ignore();
cin.get();
return 0;
}
This crashes for me at
delete[] pFoo;
I know this is crashing because of VirtualAlloc but I'm not sure how to fix this...