Commit 20c57466 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Fix a possible memory leak.

parent 9c018fd8
......@@ -2816,8 +2816,8 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
LPCWSTR buffer, extension;
MSICOMPONENT *comp;
static const WCHAR szlnk[]={'.','l','n','k',0};
IShellLinkW *sl;
IPersistFile *pf;
IShellLinkW *sl = NULL;
IPersistFile *pf = NULL;
HRESULT res;
buffer = MSI_RecordGetString(row,4);
......@@ -2841,17 +2841,17 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
res = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkW, (LPVOID *) &sl );
if (FAILED(res))
if (FAILED( res ))
{
ERR("Is IID_IShellLink\n");
return ERROR_SUCCESS;
ERR("CLSID_ShellLink not available\n");
goto err;
}
res = IShellLinkW_QueryInterface( sl, &IID_IPersistFile,(LPVOID*) &pf );
if( FAILED( res ) )
if (FAILED( res ))
{
ERR("Is IID_IPersistFile\n");
return ERROR_SUCCESS;
ERR("QueryInterface(IID_IPersistFile) failed\n");
goto err;
}
buffer = MSI_RecordGetString(row,2);
......@@ -2937,7 +2937,10 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
msi_free(target_file);
err:
if (pf)
IPersistFile_Release( pf );
if (sl)
IShellLinkW_Release( sl );
return ERROR_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment