Commit 8c3ed829 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user.exe16: Fix memory leak in case when HeapReAlloc fails.

parent f7fd2c2b
......@@ -3245,8 +3245,11 @@ DWORD WINAPI FormatMessage16(
/* CMF - This makes a BIG assumption about va_list */
while ((ret = vsnprintf(b, sz, fmtstr, (va_list) argliststart)) < 0 || ret >= sz) {
LPSTR new_b;
sz = (ret == -1 ? sz + 100 : ret + 1);
b = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, b, sz);
new_b = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, b, sz);
if (!new_b) break;
b = new_b;
}
for (x=b; *x; x++) ADD_TO_T(*x);
HeapFree(GetProcessHeap(), 0, b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment