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,12 +602,10 @@ static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * recor
}
/* update the cached actionformat */
if (package->ActionFormat)
HeapFree(GetProcessHeap(),0,package->ActionFormat);
HeapFree(GetProcessHeap(),0,package->ActionFormat);
package->ActionFormat = load_dynamic_stringW(row,3);
if (package->LastAction)
HeapFree(GetProcessHeap(),0,package->LastAction);
HeapFree(GetProcessHeap(),0,package->LastAction);
package->LastAction = dupstrW(action);
msiobj_release(&row->hdr);
......@@ -2400,8 +2398,7 @@ 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);
HeapFree(GetProcessHeap(),0, package->folders[index].TargetDefault);
package->folders[index].TargetDefault = dupstrW(targetdir);
}
......@@ -2769,8 +2766,7 @@ 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);
HeapFree(GetProcessHeap(),0,file->TargetPath);
TRACE("file %s is named %s\n",
debugstr_w(file->File),debugstr_w(file->FileName));
......@@ -3329,8 +3325,7 @@ 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);
HeapFree(GetProcessHeap(),0,file->TargetPath);
file->TargetPath = build_directory_name(2, p, file->FileName);
......@@ -3484,8 +3479,7 @@ 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);
HeapFree(GetProcessHeap(),0,file_source);
continue;
}
......@@ -3519,8 +3513,7 @@ 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);
HeapFree(GetProcessHeap(),0,file_source);
break;
}
}
......@@ -3786,14 +3779,10 @@ 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);
HeapFree(GetProcessHeap(),0,uikey);
HeapFree(GetProcessHeap(),0,key);
HeapFree(GetProcessHeap(),0,name);
HeapFree(GetProcessHeap(),0,component);
}
MSI_ViewClose(view);
msiobj_release(&view->hdr);
......@@ -5274,8 +5263,7 @@ 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);
HeapFree(GetProcessHeap(),0,component);
if (package->components[component_index].ActionRequest !=
INSTALLSTATE_LOCAL)
......@@ -6035,8 +6023,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
if (!path)
return ERROR_INVALID_PARAMETER;
if (folder->Property)
HeapFree(GetProcessHeap(),0,folder->Property);
HeapFree(GetProcessHeap(),0,folder->Property);
len = strlenW(szFolderPath);
......@@ -6065,8 +6052,7 @@ 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);
HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedTarget);
package->folders[i].ResolvedTarget=NULL;
}
......
......@@ -767,8 +767,7 @@ MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szConditio
r = MsiEvaluateConditionW( hInstall, szwCond );
if( szwCond )
HeapFree( GetProcessHeap(), 0, szwCond );
HeapFree( GetProcessHeap(), 0, szwCond );
return r;
}
......@@ -178,8 +178,7 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view )
if( !dv->table )
return ERROR_FUNCTION_FAILED;
if( dv->translation )
HeapFree( GetProcessHeap(), 0, dv->translation );
HeapFree( GetProcessHeap(), 0, dv->translation );
dv->translation = NULL;
dv->row_count = 0;
......@@ -239,8 +238,7 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
if( dv->table )
dv->table->ops->delete( dv->table );
if( dv->translation )
HeapFree( GetProcessHeap(), 0, dv->translation );
HeapFree( GetProcessHeap(), 0, dv->translation );
msiobj_release( &dv->db->hdr );
HeapFree( GetProcessHeap(), 0, dv );
......
......@@ -381,10 +381,8 @@ 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 );
HeapFree( GetProcessHeap(), 0, szwPersist );
HeapFree( GetProcessHeap(), 0, szwDBPath );
return r;
}
......@@ -406,8 +404,7 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
ret = MsiOpenProductW( szwProd, phProduct );
if( szwProd )
HeapFree( GetProcessHeap(), 0, szwProd );
HeapFree( GetProcessHeap(), 0, szwProd );
return ret;
}
......@@ -467,8 +464,7 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
r = MsiOpenPackageW( path, phProduct );
end:
if( path )
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, path );
if( hKeyProduct )
RegCloseKey( hKeyProduct );
RegCloseKey( hKeyUninstall );
......@@ -530,11 +526,8 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
r = MsiInstallProductW( szwPath, szwCommand );
end:
if( szwPath )
HeapFree( GetProcessHeap(), 0, szwPath );
if( szwCommand )
HeapFree( GetProcessHeap(), 0, szwCommand );
HeapFree( GetProcessHeap(), 0, szwPath );
HeapFree( GetProcessHeap(), 0, szwCommand );
return r;
}
......@@ -705,8 +698,7 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
end:
if( szwProduct )
HeapFree( GetProcessHeap(), 0, szwProduct );
HeapFree( GetProcessHeap(), 0, szwProduct );
return hr;
}
......@@ -752,10 +744,8 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
}
end:
if( szwComponent )
HeapFree( GetProcessHeap(), 0, szwComponent );
if( szwBuffer )
HeapFree( GetProcessHeap(), 0, szwBuffer );
HeapFree( GetProcessHeap(), 0, szwComponent );
HeapFree( GetProcessHeap(), 0, szwBuffer );
return hr;
}
......@@ -820,12 +810,9 @@ 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 );
HeapFree( GetProcessHeap(), 0, szwProduct );
HeapFree( GetProcessHeap(), 0, szwAttribute );
HeapFree( GetProcessHeap(), 0, szwBuffer );
return hr;
}
......@@ -885,8 +872,7 @@ UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
hr = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
end:
if( szwLogFile )
HeapFree( GetProcessHeap(), 0, szwLogFile );
HeapFree( GetProcessHeap(), 0, szwLogFile );
return hr;
}
......@@ -1169,8 +1155,7 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
szParent, GUID_SIZE, NULL, NULL);
}
if( szwProduct )
HeapFree( GetProcessHeap(), 0, szwProduct);
HeapFree( GetProcessHeap(), 0, szwProduct);
return r;
}
......@@ -1282,8 +1267,7 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
szProduct, GUID_SIZE, NULL, NULL);
}
if( szwComponent )
HeapFree( GetProcessHeap(), 0, 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,8 +187,7 @@ static UINT ORDER_close( struct tagMSIVIEW *view )
if( !ov->table )
return ERROR_FUNCTION_FAILED;
if( ov->reorder )
HeapFree( GetProcessHeap(), 0, ov->reorder );
HeapFree( GetProcessHeap(), 0, ov->reorder );
ov->reorder = NULL;
return ov->table->ops->close( ov->table );
......@@ -240,8 +239,7 @@ static UINT ORDER_delete( struct tagMSIVIEW *view )
if( ov->table )
ov->table->ops->delete( ov->table );
if( ov->reorder )
HeapFree( GetProcessHeap(), 0, ov->reorder );
HeapFree( GetProcessHeap(), 0, ov->reorder );
ov->reorder = NULL;
msiobj_release( &ov->db->hdr );
......
......@@ -76,8 +76,7 @@ UINT WINAPI MsiOpenPackageA(LPCSTR szPackage, MSIHANDLE *phPackage)
ret = MsiOpenPackageW( szwPack, phPackage );
if( szwPack )
HeapFree( GetProcessHeap(), 0, szwPack );
HeapFree( GetProcessHeap(), 0, szwPack );
return ret;
}
......@@ -649,10 +648,8 @@ 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 );
HeapFree( GetProcessHeap(), 0, szwName );
HeapFree( GetProcessHeap(), 0, szwValue );
return hr;
}
......
......@@ -393,8 +393,7 @@ 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 );
HeapFree( GetProcessHeap(), 0, str );
return r;
}
......
......@@ -65,8 +65,7 @@ UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase,
ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, phSummaryInfo);
if( szwDatabase )
HeapFree( GetProcessHeap(), 0, szwDatabase );
HeapFree( GetProcessHeap(), 0, szwDatabase );
return ret;
}
......
......@@ -747,10 +747,8 @@ UINT load_string_table( MSIDATABASE *db )
ret = ERROR_SUCCESS;
end:
if( pool )
HeapFree( GetProcessHeap(), 0, pool );
if( data )
HeapFree( GetProcessHeap(), 0, data );
HeapFree( GetProcessHeap(), 0, pool );
HeapFree( GetProcessHeap(), 0, data );
return ret;
}
......@@ -830,10 +828,8 @@ UINT save_string_table( MSIDATABASE *db )
ret = ERROR_SUCCESS;
err:
if( data )
HeapFree( GetProcessHeap(), 0, data );
if( pool )
HeapFree( GetProcessHeap(), 0, pool );
HeapFree( GetProcessHeap(), 0, data );
HeapFree( GetProcessHeap(), 0, pool );
return ret;
}
......
......@@ -269,8 +269,7 @@ static UINT WHERE_close( struct tagMSIVIEW *view )
if( !wv->table )
return ERROR_FUNCTION_FAILED;
if( wv->reorder )
HeapFree( GetProcessHeap(), 0, wv->reorder );
HeapFree( GetProcessHeap(), 0, wv->reorder );
wv->reorder = NULL;
return wv->table->ops->close( wv->table );
......@@ -329,8 +328,7 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
if( wv->table )
wv->table->ops->delete( wv->table );
if( wv->reorder )
HeapFree( GetProcessHeap(), 0, 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