mstask: Move memory allocation to avoid a memory leak (Valgrind).

Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit e4f15a297f)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
oldstable
Sven Baars 2019-02-06 11:48:19 +01:00 committed by Michael Stefaniuc
parent cf05d6679d
commit c9dad2c6ce
1 changed files with 4 additions and 4 deletions

View File

@ -143,10 +143,6 @@ static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPW
enumerated = 0;
list = NULL;
allocated = 64;
list = CoTaskMemAlloc(allocated * sizeof(list[0]));
if (!list) return E_OUTOFMEMORY;
if (This->handle == INVALID_HANDLE_VALUE)
{
GetWindowsDirectoryW(path, MAX_PATH);
@ -161,6 +157,10 @@ static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPW
return S_FALSE;
}
allocated = 64;
list = CoTaskMemAlloc(allocated * sizeof(list[0]));
if (!list) return E_OUTOFMEMORY;
do
{
if (is_file(&data))