plug-ins: fix memory cleanup.

This issue was raised by Anders in #15152 and it was a mean one, because
it really looked like file-ani-export was crashing inside
_gimp_procedure_config_end_export() (so after its main run function),
but somehow only when being called from another plug-in (in particular
here, from the file-compressor plug-in). So it looked like a bug
somewhere in libgimp.

It turned out to be a "simple" memory corruption which was not
immediately showing its consequences.
This commit is contained in:
Jehan 2025-10-31 00:23:36 +01:00
parent a5fe4f1ca5
commit 381fad7253
2 changed files with 11 additions and 12 deletions

View file

@ -1455,8 +1455,8 @@ ani_export_image (GFile *file,
if (status != GIMP_PDB_SUCCESS)
{
ico_save_info_free (&info);
g_free (ani_info->inam);
g_free (ani_info->iart);
g_clear_pointer (&ani_info->inam, g_free);
g_clear_pointer (&ani_info->iart, g_free);
fclose (fp);
return GIMP_PDB_EXECUTION_ERROR;
}

View file

@ -715,19 +715,18 @@ ani_export (GimpProcedure *procedure,
"cursor-name", NULL,
"author-name", NULL,
"default-delay", header.jif_rate,
"hot-spot-x", x_array,
"hot-spot-y", y_array,
"hot-spot-x", x_array,
"hot-spot-y", y_array,
NULL);
g_free (new_hot_spot_x);
g_free (new_hot_spot_y);
g_free (inam);
g_free (iart);
g_free (ani_info.inam);
g_free (ani_info.iart);
memset (&ani_info, 0, sizeof (AniSaveInfo));
}
g_free (new_hot_spot_x);
g_free (new_hot_spot_y);
g_free (ani_info.inam);
g_free (ani_info.iart);
gimp_array_free (x_array);
gimp_array_free (y_array);
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image);