Free allocated buffers.

This commit is contained in:
Aric Stewart 2005-01-03 14:29:09 +00:00 committed by Alexandre Julliard
parent d598098961
commit 51cf7d13c0
3 changed files with 43 additions and 11 deletions

View File

@ -423,6 +423,47 @@ void ACTION_remove_tracked_tempfiles(MSIPACKAGE* package)
}
}
/* Called when the package is being closed */
extern void ACTION_free_package_structures( MSIPACKAGE* package)
{
INT i;
TRACE("Freeing package action data\n");
/* No dynamic buffers in features */
if (package->features && package->loaded_features > 0)
HeapFree(GetProcessHeap(),0,package->features);
for (i = 0; i < package->loaded_folders; i++)
{
HeapFree(GetProcessHeap(),0,package->folders[i].Directory);
HeapFree(GetProcessHeap(),0,package->folders[i].TargetDefault);
HeapFree(GetProcessHeap(),0,package->folders[i].SourceDefault);
HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedTarget);
HeapFree(GetProcessHeap(),0,package->folders[i].ResolvedSource);
HeapFree(GetProcessHeap(),0,package->folders[i].Property);
}
if (package->folders && package->loaded_folders > 0)
HeapFree(GetProcessHeap(),0,package->folders);
/* no dynamic buffers in components */
if (package->components && package->loaded_components > 0)
HeapFree(GetProcessHeap(),0,package->components);
for (i = 0; i < package->loaded_files; i++)
{
HeapFree(GetProcessHeap(),0,package->files[i].File);
HeapFree(GetProcessHeap(),0,package->files[i].FileName);
HeapFree(GetProcessHeap(),0,package->files[i].Version);
HeapFree(GetProcessHeap(),0,package->files[i].Language);
HeapFree(GetProcessHeap(),0,package->files[i].SourcePath);
HeapFree(GetProcessHeap(),0,package->files[i].TargetPath);
}
if (package->files && package->loaded_files > 0)
HeapFree(GetProcessHeap(),0,package->files);
}
static UINT ACTION_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
{
LPWSTR szQuery;

View File

@ -273,6 +273,7 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
USHORT **pdata, UINT *psz );
extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern void ACTION_remove_tracked_tempfiles( MSIPACKAGE* );
extern void ACTION_free_package_structures( MSIPACKAGE* );
/* record internals */
extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);

View File

@ -53,18 +53,8 @@ void MSI_FreePackage( MSIOBJECTHDR *arg)
MSIPACKAGE *package= (MSIPACKAGE*) arg;
ACTION_remove_tracked_tempfiles(package);
ACTION_free_package_structures(package);
if (package->features && package->loaded_features > 0)
HeapFree(GetProcessHeap(),0,package->features);
if (package->folders && package->loaded_folders > 0)
HeapFree(GetProcessHeap(),0,package->folders);
if (package->components && package->loaded_components > 0)
HeapFree(GetProcessHeap(),0,package->components);
if (package->files && package->loaded_files > 0)
HeapFree(GetProcessHeap(),0,package->files);
msiobj_release( &package->db->hdr );
}