shell32: Fix a memory leak.

Found by Valgrind.
This commit is contained in:
Huw Davies 2009-12-17 10:12:04 +00:00 committed by Alexandre Julliard
parent c89211336b
commit b71173f7ac
1 changed files with 6 additions and 0 deletions

View File

@ -2213,7 +2213,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
/* any other quote marks are invalid */ /* any other quote marks are invalid */
if (strchrW(pszFile, '"')) if (strchrW(pszFile, '"'))
{
HeapFree(GetProcessHeap(), 0, unquoted);
return S_FALSE; return S_FALSE;
}
HeapFree(GetProcessHeap(), 0, This->sPath); HeapFree(GetProcessHeap(), 0, This->sPath);
This->sPath = NULL; This->sPath = NULL;
@ -2241,7 +2244,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
This->sPath = HeapAlloc( GetProcessHeap(), 0, This->sPath = HeapAlloc( GetProcessHeap(), 0,
(lstrlenW( buffer )+1) * sizeof (WCHAR) ); (lstrlenW( buffer )+1) * sizeof (WCHAR) );
if (!This->sPath) if (!This->sPath)
{
HeapFree(GetProcessHeap(), 0, unquoted);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
lstrcpyW(This->sPath, buffer); lstrcpyW(This->sPath, buffer);
} }