From 2dac80524440bbae0ee0ef67c470bc0073b8bfaf Mon Sep 17 00:00:00 2001 From: Sven Baars Date: Sun, 4 Oct 2020 18:10:23 +0200 Subject: [PATCH] shell32: Fix a leak on error path (Coverity). Signed-off-by: Sven Baars Signed-off-by: Alexandre Julliard --- dlls/shell32/shfldr_unixfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c index a37b1bf5881..48d5fe4ecb6 100644 --- a/dlls/shell32/shfldr_unixfs.c +++ b/dlls/shell32/shfldr_unixfs.c @@ -1251,7 +1251,10 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface, LPWSTR pwszDosFileName = wine_get_dos_file_name(This->m_pszPath); if (!pwszDosFileName) return HRESULT_FROM_WIN32(GetLastError()); lpName->u.pOleStr = SHAlloc((lstrlenW(pwszDosFileName) + 1) * sizeof(WCHAR)); - if (!lpName->u.pOleStr) return HRESULT_FROM_WIN32(GetLastError()); + if (!lpName->u.pOleStr) { + heap_free(pwszDosFileName); + return HRESULT_FROM_WIN32(GetLastError()); + } lstrcpyW(lpName->u.pOleStr, pwszDosFileName); PathRemoveBackslashW(lpName->u.pOleStr); heap_free(pwszDosFileName);