Commit b937407e authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

Do not check for non NULL pointer before HeapFree'ing it. It's

redundant.
parent 717eb8ff
......@@ -602,11 +602,9 @@ static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * recor
}
/* update the cached actionformat */
if (package->ActionFormat)
HeapFree(GetProcessHeap(),0,package->ActionFormat);
package->ActionFormat = load_dynamic_stringW(row,3);
if (package->LastAction)
HeapFree(GetProcessHeap(),0,package->LastAction);
package->LastAction = dupstrW(action);
......@@ -2400,7 +2398,6 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
if (targetdir)
{
TRACE(" TargetDefault = %s\n",debugstr_w(targetdir));
if (package->folders[index].TargetDefault)
HeapFree(GetProcessHeap(),0, package->folders[index].TargetDefault);
package->folders[index].TargetDefault = dupstrW(targetdir);
}
......@@ -2769,7 +2766,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* calculate target */
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
if (file->TargetPath)
HeapFree(GetProcessHeap(),0,file->TargetPath);
TRACE("file %s is named %s\n",
......@@ -3329,7 +3325,6 @@ static UINT ACTION_InstallFiles(MSIPACKAGE *package)
comp = &package->components[file->ComponentIndex];
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
if (file->TargetPath)
HeapFree(GetProcessHeap(),0,file->TargetPath);
file->TargetPath = build_directory_name(2, p, file->FileName);
......@@ -3484,7 +3479,6 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
{
ERR("Original file unknown %s\n",debugstr_w(file_key));
msiobj_release(&row->hdr);
if (file_source)
HeapFree(GetProcessHeap(),0,file_source);
continue;
}
......@@ -3519,7 +3513,6 @@ static UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
{
ERR("Unable to get destination folder\n");
msiobj_release(&row->hdr);
if (file_source)
HeapFree(GetProcessHeap(),0,file_source);
break;
}
......@@ -3786,13 +3779,9 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
msiobj_release(&row->hdr);
RegCloseKey(hkey);
next:
if (uikey)
HeapFree(GetProcessHeap(),0,uikey);
if (key)
HeapFree(GetProcessHeap(),0,key);
if (name)
HeapFree(GetProcessHeap(),0,name);
if (component)
HeapFree(GetProcessHeap(),0,component);
}
MSI_ViewClose(view);
......@@ -5274,7 +5263,6 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
component = load_dynamic_stringW(row, 8);
component_index = get_loaded_component(package,component);
if (component)
HeapFree(GetProcessHeap(),0,component);
if (package->components[component_index].ActionRequest !=
......@@ -6035,7 +6023,6 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
if (!path)
return ERROR_INVALID_PARAMETER;
if (folder->Property)
HeapFree(GetProcessHeap(),0,folder->Property);
len = strlenW(szFolderPath);
......@@ -6065,7 +6052,6 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
{
for (i = 0; i < package->loaded_folders; i++)
{
if (package->folders[i].ResolvedTarget)
HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedTarget);
package->folders[i].ResolvedTarget=NULL;
}
......
......@@ -767,7 +767,6 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio
r = MsiEvaluateConditionW( hInstall, szwCond );
if( szwCond )
HeapFree( GetProcessHeap(), 0, szwCond );
return r;
......
......@@ -178,7 +178,6 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view )
if( !dv->table )
return ERROR_FUNCTION_FAILED;
if( dv->translation )
HeapFree( GetProcessHeap(), 0, dv->translation );
dv->translation = NULL;
dv->row_count = 0;
......@@ -239,7 +238,6 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
if( dv->table )
dv->table->ops->delete( dv->table );
if( dv->translation )
HeapFree( GetProcessHeap(), 0, dv->translation );
msiobj_release( &dv->db->hdr );
HeapFree( GetProcessHeap(), 0, dv );
......
......@@ -381,9 +381,7 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
end:
if( szwPersist )
HeapFree( GetProcessHeap(), 0, szwPersist );
if( szwDBPath )
HeapFree( GetProcessHeap(), 0, szwDBPath );
return r;
......@@ -406,7 +404,6 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
ret = MsiOpenProductW( szwProd, phProduct );
if( szwProd )
HeapFree( GetProcessHeap(), 0, szwProd );
return ret;
......@@ -467,7 +464,6 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
r = MsiOpenPackageW( path, phProduct );
end:
if( path )
HeapFree( GetProcessHeap(), 0, path );
if( hKeyProduct )
RegCloseKey( hKeyProduct );
......@@ -530,10 +526,7 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
r = MsiInstallProductW( szwPath, szwCommand );
end:
if( szwPath )
HeapFree( GetProcessHeap(), 0, szwPath );
if( szwCommand )
HeapFree( GetProcessHeap(), 0, szwCommand );
return r;
......@@ -705,7 +698,6 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
end:
if( szwProduct )
HeapFree( GetProcessHeap(), 0, szwProduct );
return hr;
......@@ -752,9 +744,7 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
}
end:
if( szwComponent )
HeapFree( GetProcessHeap(), 0, szwComponent );
if( szwBuffer )
HeapFree( GetProcessHeap(), 0, szwBuffer );
return hr;
......@@ -820,11 +810,8 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute, LPSTR szBuf
}
end:
if( szwProduct )
HeapFree( GetProcessHeap(), 0, szwProduct );
if( szwAttribute )
HeapFree( GetProcessHeap(), 0, szwAttribute );
if( szwBuffer )
HeapFree( GetProcessHeap(), 0, szwBuffer );
return hr;
......@@ -885,7 +872,6 @@ UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
end:
if( szwLogFile )
HeapFree( GetProcessHeap(), 0, szwLogFile );
return hr;
......@@ -1169,7 +1155,6 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
szParent, GUID_SIZE, NULL, NULL);
}
if( szwProduct )
HeapFree( GetProcessHeap(), 0, szwProduct);
return r;
......@@ -1282,7 +1267,6 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
szProduct, GUID_SIZE, NULL, NULL);
}
if( szwComponent )
HeapFree( GetProcessHeap(), 0, szwComponent);
return r;
......@@ -1647,9 +1631,9 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf, DWORD* pcc
WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1, lpLangBuf, *pcchLangBuf, NULL, NULL);
end:
if(szwFilePath) HeapFree(GetProcessHeap(), 0, szwFilePath);
if(lpwVersionBuff) HeapFree(GetProcessHeap(), 0, lpwVersionBuff);
if(lpwLangBuff) HeapFree(GetProcessHeap(), 0, lpwLangBuff);
HeapFree(GetProcessHeap(), 0, szwFilePath);
HeapFree(GetProcessHeap(), 0, lpwVersionBuff);
HeapFree(GetProcessHeap(), 0, lpwLangBuff);
return ret;
}
......@@ -1705,7 +1689,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, DWORD* p
}
end:
if(lpVer) HeapFree(GetProcessHeap(), 0, lpVer);
HeapFree(GetProcessHeap(), 0, lpVer);
return ret;
}
......
......@@ -187,7 +187,6 @@ static UINT ORDER_close( struct tagMSIVIEW *view )
if( !ov->table )
return ERROR_FUNCTION_FAILED;
if( ov->reorder )
HeapFree( GetProcessHeap(), 0, ov->reorder );
ov->reorder = NULL;
......@@ -240,7 +239,6 @@ static UINT ORDER_delete( struct tagMSIVIEW *view )
if( ov->table )
ov->table->ops->delete( ov->table );
if( ov->reorder )
HeapFree( GetProcessHeap(), 0, ov->reorder );
ov->reorder = NULL;
......
......@@ -76,7 +76,6 @@ UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
ret = MsiOpenPackageW( szwPack, phPackage );
if( szwPack )
HeapFree( GetProcessHeap(), 0, szwPack );
return ret;
......@@ -649,9 +648,7 @@ UINT WINAPI MsiSetPropertyA( MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
hr = MsiSetPropertyW( hInstall, szwName, szwValue);
end:
if( szwName )
HeapFree( GetProcessHeap(), 0, szwName );
if( szwValue )
HeapFree( GetProcessHeap(), 0, szwValue );
return hr;
......
......@@ -393,7 +393,6 @@ UINT msi_string2idA( string_table *st, LPCSTR buffer, UINT *id )
MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz );
r = msi_string2idW( st, str, id );
if( str )
HeapFree( GetProcessHeap(), 0, str );
return r;
......
......@@ -65,7 +65,6 @@ UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase,
ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, phSummaryInfo);
if( szwDatabase )
HeapFree( GetProcessHeap(), 0, szwDatabase );
return ret;
......
......@@ -747,9 +747,7 @@ UINT load_string_table( MSIDATABASE *db )
ret = ERROR_SUCCESS;
end:
if( pool )
HeapFree( GetProcessHeap(), 0, pool );
if( data )
HeapFree( GetProcessHeap(), 0, data );
return ret;
......@@ -830,9 +828,7 @@ UINT save_string_table( MSIDATABASE *db )
ret = ERROR_SUCCESS;
err:
if( data )
HeapFree( GetProcessHeap(), 0, data );
if( pool )
HeapFree( GetProcessHeap(), 0, pool );
return ret;
......
......@@ -269,7 +269,6 @@ static UINT WHERE_close( struct tagMSIVIEW *view )
if( !wv->table )
return ERROR_FUNCTION_FAILED;
if( wv->reorder )
HeapFree( GetProcessHeap(), 0, wv->reorder );
wv->reorder = NULL;
......@@ -329,7 +328,6 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
if( wv->table )
wv->table->ops->delete( wv->table );
if( wv->reorder )
HeapFree( GetProcessHeap(), 0, wv->reorder );
wv->reorder = NULL;
wv->row_count = 0;
......
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