mstask: Fix some memory leaks on error path (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
48e6f8f99d
commit
3804b99e72
|
@ -1690,7 +1690,11 @@ static HRESULT WINAPI MSTASK_IPersistFile_Save(IPersistFile *iface, LPCOLESTR ta
|
|||
hfile = CreateFileW(task_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, disposition, 0, 0);
|
||||
if (hfile != INVALID_HANDLE_VALUE) break;
|
||||
|
||||
if (try++ >= 3) return HRESULT_FROM_WIN32(GetLastError());
|
||||
if (try++ >= 3)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
goto failed;
|
||||
}
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
|
@ -1781,6 +1785,8 @@ failed:
|
|||
CoTaskMemFree(comment);
|
||||
CoTaskMemFree(user_data);
|
||||
|
||||
if (hfile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(hfile);
|
||||
if (hr != S_OK)
|
||||
DeleteFileW(task_name);
|
||||
|
@ -1789,6 +1795,7 @@ failed:
|
|||
heap_free(This->task_name);
|
||||
This->task_name = heap_strdupW(task_name);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue