summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/io-xbm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
index 5bf71e1bf..c78734cbb 100644
--- a/gdk-pixbuf/io-xbm.c
+++ b/gdk-pixbuf/io-xbm.c
@@ -304,7 +304,7 @@ gdk_pixbuf__xbm_image_load_real (FILE *f,
{
guint w, h;
int x_hot, y_hot;
- guchar *data, *ptr;
+ guchar *data = NULL, *ptr;
guchar *pixels;
guint row_stride;
int x, y;
@@ -324,6 +324,7 @@ gdk_pixbuf__xbm_image_load_real (FILE *f,
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h);
if (pixbuf == NULL) {
+ g_free (data);
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
@@ -362,9 +363,9 @@ gdk_pixbuf__xbm_image_load_real (FILE *f,
reg >>= 1;
bits--;
- pixels[x*3+0] = channel;
- pixels[x*3+1] = channel;
- pixels[x*3+2] = channel;
+ pixels[x * 3 + 0] = channel;
+ pixels[x * 3 + 1] = channel;
+ pixels[x * 3 + 2] = channel;
}
pixels += row_stride;
}