user.exe16: Fix memory leaks in cases when HeapReAlloc fails.

Alexandre Julliard julliard at winehq.org
Wed Jun 21 03:39:53 CDT 2017


Dmitry Timoshkov <dmitry at baikal.ru> writes:

> @@ -3286,7 +3289,8 @@ DWORD WINAPI FormatMessage16(
>      }
>      talloced = strlen(target)+1;
>      if (nSize && talloced<nSize) {
> -        target = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
> +        LPSTR new_target = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
> +        if (new_target) target = new_target;

You could probably remove it entirely.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list