summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-11-10 01:27:50 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2020-11-10 01:27:50 +0000
commitbb129a69f28030c8daf25c20fd408b0482f30baf (patch)
treed6cb6eb55269f428544d5055e478d18efc0a184f /gdk-pixbuf
parenta0ff5afa5147f9f89a6f8d1764bf4e4e15676337 (diff)
downloadgdk-pixbuf-bb129a69f28030c8daf25c20fd408b0482f30baf.tar.gz
xbm: Free data in error path
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;
}