[gtk/wip/baedert/for-master: 2/2] loaders: Get rid of some uninitialized values




commit 3386faefe375da8929006d27899fecdd44fadf63
Author: Timm Bäder <mail baedert org>
Date:   Fri Oct 22 19:37:04 2021 +0200

    loaders: Get rid of some uninitialized values

 gdk/loaders/gdkjpeg.c | 6 +++---
 gdk/loaders/gdkpng.c  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gdk/loaders/gdkjpeg.c b/gdk/loaders/gdkjpeg.c
index 8cbb0438a4..f5a8aa7b69 100644
--- a/gdk/loaders/gdkjpeg.c
+++ b/gdk/loaders/gdkjpeg.c
@@ -174,12 +174,12 @@ gdk_load_jpeg (GBytes  *input_bytes,
     case JCS_GRAYSCALE:
     case JCS_RGB:
       stride = 3 * width;
-      data = g_try_malloc_n (stride, height);
+      data = g_try_malloc0_n (stride, height);
       format = GDK_MEMORY_R8G8B8;
       break;
     case JCS_CMYK:
       stride = 4 * width;
-      data = g_try_malloc_n (stride, height);
+      data = g_try_malloc0_n (stride, height);
       format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
       break;
     default:
@@ -242,7 +242,7 @@ gdk_save_jpeg (GdkTexture *texture)
   struct jpeg_compress_struct info;
   struct error_handler_data jerr;
   struct jpeg_error_mgr err;
-  guchar *data;
+  guchar *data = NULL;
   gulong size = 0;
   guchar *input = NULL;
   GdkMemoryTexture *memtex = NULL;
diff --git a/gdk/loaders/gdkpng.c b/gdk/loaders/gdkpng.c
index 11ed7e4ef9..eeb76dbc92 100644
--- a/gdk/loaders/gdkpng.c
+++ b/gdk/loaders/gdkpng.c
@@ -307,7 +307,7 @@ gdk_save_png (GdkTexture *texture)
   gsize stride;
   const guchar *data;
   int y;
-  GdkMemoryTexture *memtex;
+  GdkMemoryTexture *memtex = NULL;
   GdkMemoryFormat format;
   int png_format;
   int depth;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]