There is no need to need to delete the contents of the vStringList. That memory will be auto deleted when it goes out of scope.
The reason you are detecting memory leaks, is because you're checking for leaks before the function ends and the objects go out of scope. The objects haven't been cleaned up yet (by design), so you're seeing objects that are legitimately allocated and mistaking them for leaks.
An easier and more reliable way to check for leaks in Microsoft C++ code is to add the following code snippet to the top of your .cpp modules, after the header includes.
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
Then run the program in the debugger. When the program exits, you'll see any leaks in the trace window.
This method will be more reliable for you, because the leak checking is done after all of the globals that you've instantiated, go out of scope.
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
int main()
{
vector<string> vStringList;
char * pLeak = new char[1024];
for(int i = 0;i <5;i++)
{
char filename[1024];
sprintf(filename, "%s_%d", "myfile",i+1);
vStringList.push_back(filename);
}
return 0;
}