FormatMessage函数难道会自动申请一个字符串空间 ?

string GetErrorMsg() { DWORD dwErrorId = GetLastError(); LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorId, 0, (LPSTR) &lpMsgBuf, 0, NULL); string strErrorMsg = (char*)lpMsgBuf; LocalFree(lpMsgBuf); return strErrorMsg; }请问为什么lpMsgBuf变量没有申请空间,却要使用LocalFree释放空间