kernel32: Consistify allocation behavior with FormatMessageA/W.

This commit is contained in:
Andrew Nguyen 2010-04-18 09:09:21 -05:00 committed by Alexandre Julliard
parent 8e20322578
commit fcdd0d3040
1 changed files with 1 additions and 2 deletions

View File

@ -752,8 +752,7 @@ DWORD WINAPI FormatMessageW(
TRACE("-- %s\n",debugstr_w(target));
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
/* nSize is the MINIMUM size */
DWORD len = strlenW(target) + 1;
*((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR));
*((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT, max(nSize, talloced)*sizeof(WCHAR));
strcpyW(*(LPWSTR*)lpBuffer, target);
}
else