Commit f86cfd40 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Avoid a memory leak by freeing actions scripts in one place only.

parent f5dddd55
......@@ -1491,14 +1491,10 @@ static UINT execute_script(MSIPACKAGE *package, UINT script )
ui_actionstart(package, action);
TRACE("Executing Action (%s)\n",debugstr_w(action));
rc = ACTION_PerformAction(package, action, TRUE);
msi_free(package->script->Actions[script][i]);
if (rc != ERROR_SUCCESS)
break;
}
msi_free(package->script->Actions[script]);
package->script->ActionCount[script] = 0;
package->script->Actions[script] = NULL;
msi_free_action_script(package, script);
return rc;
}
......
......@@ -384,6 +384,17 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
return ERROR_SUCCESS;
}
void msi_free_action_script(MSIPACKAGE *package, UINT script)
{
int i;
for (i = 0; i < package->script->ActionCount[script]; i++)
msi_free(package->script->Actions[script][i]);
msi_free(package->script->Actions[script]);
package->script->Actions[script] = NULL;
package->script->ActionCount[script] = 0;
}
static void remove_tracked_tempfiles(MSIPACKAGE* package)
{
struct list *item, *cursor;
......@@ -571,13 +582,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
if (package->script)
{
for (i = 0; i < TOTAL_SCRIPTS; i++)
{
int j;
for (j = 0; j < package->script->ActionCount[i]; j++)
msi_free(package->script->Actions[i][j]);
msi_free(package->script->Actions[i]);
}
msi_free_action_script(package, i);
for (i = 0; i < package->script->UniqueActionsCount; i++)
msi_free(package->script->UniqueActions[i]);
......
......@@ -752,6 +752,7 @@ extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
extern void msi_free_action_script(MSIPACKAGE *package, UINT script);
extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
extern LPWSTR build_directory_name(DWORD , ...);
extern BOOL create_full_pathW(const WCHAR *path);
......
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