Commit e4f15a29 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

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

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