Module: wine Branch: master Commit: fcdd0d30400ee791ed4098bcf360eb928b01309b URL: http://source.winehq.org/git/wine.git/?a=commit;h=fcdd0d30400ee791ed4098bcf3...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Sun Apr 18 09:09:21 2010 -0500
kernel32: Consistify allocation behavior with FormatMessageA/W.
---
dlls/kernel32/format_msg.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 8c37434..db97300 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -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