Sven Baars : shell32: Fix a leak on error path (Coverity).

Alexandre Julliard julliard at winehq.org
Tue Mar 23 15:07:45 CDT 2021


Module: wine
Branch: oldstable
Commit: 01f7e4bafc8091f783e23421235e432064d78352
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=01f7e4bafc8091f783e23421235e432064d78352

Author: Sven Baars <sbaars at codeweavers.com>
Date:   Sun Oct  4 18:10:23 2020 +0200

shell32: Fix a leak on error path (Coverity).

Signed-off-by: Sven Baars <sbaars at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 2dac80524440bbae0ee0ef67c470bc0073b8bfaf)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 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);




More information about the wine-cvs mailing list