[gdk-pixbuf/static-analysis] xbm: Free data in error path
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/static-analysis] xbm: Free data in error path
- Date: Tue, 10 Nov 2020 01:40:10 +0000 (UTC)
commit bb129a69f28030c8daf25c20fd408b0482f30baf
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Nov 10 01:27:50 2020 +0000
xbm: Free data in error path
gdk-pixbuf/io-xbm.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
index 5bf71e1bfa..c78734cbb3 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]