don't just g_free() the GValueArray after we memcpy()-stole its values

2007-03-16  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/gimppluginprocframe.c
	(gimp_plug_in_proc_frame_get_return_vals): don't just g_free() the
	GValueArray after we memcpy()-stole its values because this both
	leaks the contained array of GValues and crashes with glib trunk
	where GValueArray is slice-allocated. Instead, free the array of
	GValues manually, set it to NULL and use g_value_array_free().


svn path=/trunk/; revision=22134
This commit is contained in:
Michael Natterer 2007-03-16 14:24:02 +00:00 committed by Michael Natterer
parent 11f0125257
commit cefff5f07f
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2007-03-16 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimppluginprocframe.c
(gimp_plug_in_proc_frame_get_return_vals): don't just g_free() the
GValueArray after we memcpy()-stole its values because this both
leaks the contained array of GValues and crashes with glib trunk
where GValueArray is slice-allocated. Instead, free the array of
GValues manually, set it to NULL and use g_value_array_free().
2007-03-16 Michael Natterer <mitch@gimp.org>
* plug-ins/script-fu/script-fu.c: remove N_() from calls to

View File

@ -179,9 +179,15 @@ gimp_plug_in_proc_frame_get_return_vals (GimpPlugInProcFrame *proc_frame)
memcpy (return_vals->values, proc_frame->return_vals->values,
sizeof (GValue) * proc_frame->return_vals->n_values);
/* Free the old argument pointer. */
g_free (proc_frame->return_vals);
/* Free the old arguments. */
g_free (proc_frame->return_vals->values);
proc_frame->return_vals->values = 0;
proc_frame->return_vals->n_values = 0;
g_value_array_free (proc_frame->return_vals);
}
/* We have consumed any saved values, so clear them. */
proc_frame->return_vals = NULL;
}
else
{
@ -190,8 +196,5 @@ gimp_plug_in_proc_frame_get_return_vals (GimpPlugInProcFrame *proc_frame)
FALSE);
}
/* We have consumed any saved values, so clear them. */
proc_frame->return_vals = NULL;
return return_vals;
}