mstask/tests: Fix some memory leaks (Valgrind).

Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Baars 2019-01-13 15:01:16 +01:00 committed by Alexandre Julliard
parent 5b87378bbd
commit 80b572e8b2
2 changed files with 6 additions and 0 deletions

View File

@ -760,6 +760,7 @@ static void test_workitem_data(void)
ok(count == sizeof(hello), "got %u\n", count);
ok(data != NULL, "got NULL\n");
ok(!memcmp(data, hello, sizeof(hello)), "data mismatch\n");
CoTaskMemFree(data);
hr = ITask_SetWorkItemData(task, 0, NULL);
ok(hr == S_OK, "got %#x\n", hr);

View File

@ -329,11 +329,13 @@ static void test_save_task_curfile(ITask *task)
hr = IPersistFile_Save(pfile, NULL, TRUE);
ok(hr == S_OK, "Save error %#x\n", hr);
CoTaskMemFree(curfile);
curfile = NULL;
hr = IPersistFile_GetCurFile(pfile, &curfile);
ok(hr == S_OK, "GetCurFile error %#x\n", hr);
ok(curfile && curfile[0] , "curfile should not be NULL\n");
CoTaskMemFree(curfile);
IPersistFile_Release(pfile);
}
@ -454,18 +456,21 @@ static void test_task_storage(void)
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
ok(file_exists(curfile), "curfile should exist\n");
ok(!lstrcmpW(curfile, task2_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
CoTaskMemFree(curfile);
hr = ITaskScheduler_AddWorkItem(scheduler, Task3, (IScheduledWorkItem *)task);
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
ok(file_exists(curfile), "curfile should exist\n");
ok(!lstrcmpW(curfile, task3_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
CoTaskMemFree(curfile);
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
ok(file_exists(curfile), "curfile should exist\n");
ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
CoTaskMemFree(curfile);
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);