From b71173f7ac0493fac4abe3f237b6cfb22b25fcd7 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 17 Dec 2009 10:12:04 +0000 Subject: [PATCH] shell32: Fix a memory leak. Found by Valgrind. --- dlls/shell32/shelllink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 3b161705cc7..6dd62a7b01a 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -2213,7 +2213,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile /* any other quote marks are invalid */ if (strchrW(pszFile, '"')) + { + HeapFree(GetProcessHeap(), 0, unquoted); return S_FALSE; + } HeapFree(GetProcessHeap(), 0, This->sPath); This->sPath = NULL; @@ -2241,7 +2244,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile This->sPath = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( buffer )+1) * sizeof (WCHAR) ); if (!This->sPath) + { + HeapFree(GetProcessHeap(), 0, unquoted); return E_OUTOFMEMORY; + } lstrcpyW(This->sPath, buffer); } -- 2.11.4.GIT