user.exe16: Fix memory leak in case when HeapReAlloc fails.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f7fd2c2be1
commit
8c3ed82927
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue