free the result of gdk_pixdata_serialize() (bug #89411).

2002-07-31  Sven Neumann  <sven@gimp.org>

	* gdk-pixdata.c (gdk_pixdata_to_csource): free the result of
	gdk_pixdata_serialize() (bug #89411).
This commit is contained in:
Sven Neumann 2002-07-31 08:17:43 +00:00 committed by Sven Neumann
parent cc375a49d7
commit 0a786328d2
2 changed files with 21 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2002-07-31 Sven Neumann <sven@gimp.org>
* gdk-pixdata.c (gdk_pixdata_to_csource): free the result of
gdk_pixdata_serialize() (bug #89411).
Mon Jul 29 23:06:10 2002 Owen Taylor <otaylor@redhat.com>
* gdk-pixbuf-scale.c: Fix some warnings by adding

View File

@ -594,7 +594,7 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
guint bpp, width, height, rowstride;
gboolean rle_encoded;
gchar *macro_name;
guint8 *img_buffer, *img_buffer_end, *stream;
guint8 *img_buffer, *img_buffer_end, *stream = NULL;
guint stream_length;
GString *gstring;
@ -725,6 +725,7 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
guint pix_length = img_buffer_end - img_buffer;
stream = gdk_pixdata_serialize (pixdata, &stream_length);
img_buffer = stream;
img_buffer_end = stream + stream_length;
APPEND (gstring, "%s%s%s %s[] = \n",
@ -734,34 +735,33 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
APPEND (gstring, "{ \"\"\n /* Pixbuf magic (0x%x) */\n \"",
GDK_PIXBUF_MAGIC_NUMBER);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* length: header (%u) + pixel_data (%u) */\n \"",
GDK_PIXDATA_HEADER_LENGTH,
rle_encoded ? pix_length : rowstride * height);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* pixdata_type (0x%x) */\n \"",
pixdata->pixdata_type);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* rowstride (%u) */\n \"",
rowstride);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* width (%u) */\n \"", width);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* height (%u) */\n \"", height);
cdata.pos = 3;
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *stream++); save_uchar (&cdata, *stream++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
APPEND (gstring, "\"\n /* pixel_data: */\n");
img_buffer = stream;
}
/* pixel_data intro
@ -812,8 +812,9 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
/* cleanup
*/
g_free (stream);
g_free (macro_name);
return gstring;
}