app: avoid risky alloca() in gimp_brush_save()

Replace an arbitrarily-sized g_alloca() with g_malloc() in
gimp_brush_save().
This commit is contained in:
Ell 2019-03-28 16:52:08 -04:00
parent de36e33347
commit 24ed9dbdf5

View file

@ -68,7 +68,7 @@ gimp_brush_save (GimpData *data,
if (pixmap)
{
gsize size = width * height * 4;
guchar *data = g_alloca (size);
guchar *data = g_malloc (size);
guchar *p = gimp_temp_buf_get_data (pixmap);
guchar *m = gimp_temp_buf_get_data (mask);
guchar *d = data;
@ -85,9 +85,13 @@ gimp_brush_save (GimpData *data,
if (! g_output_stream_write_all (output, data, size,
NULL, NULL, error))
{
g_free (data);
return FALSE;
}
}
g_free (data);
}
else
{
if (! g_output_stream_write_all (output,