From e4f15a297f301bb3c484a827a152e5f10184ff61 Mon Sep 17 00:00:00 2001 From: Sven Baars Date: Wed, 6 Feb 2019 11:48:19 +0100 Subject: [PATCH] mstask: Move memory allocation to avoid a memory leak (Valgrind). Signed-off-by: Sven Baars Signed-off-by: Alexandre Julliard --- dlls/mstask/task_scheduler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index 7998b3a50e6..ebf25d08e80 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -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))