[gtk/wip/otte/for-master: 4/4] png: allocate data before sigsetjmp()




commit 009c5269b476cda0d064cad0afda7ca11ba95fe4
Author: Benjamin Otte <otte redhat com>
Date:   Fri Oct 22 23:51:26 2021 +0200

    png: allocate data before sigsetjmp()
    
    Makes the static analyzer not trip up when trying to analyze memory
    leaks.

 gdk/loaders/gdkpng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gdk/loaders/gdkpng.c b/gdk/loaders/gdkpng.c
index 11ed7e4ef9..4d50dfbf83 100644
--- a/gdk/loaders/gdkpng.c
+++ b/gdk/loaders/gdkpng.c
@@ -385,6 +385,8 @@ gdk_save_png (GdkTexture *texture)
       return NULL;
     }
 
+  memtex = gdk_memory_texture_from_texture (texture, format);
+
   if (sigsetjmp (png_jmpbuf (png), 1))
     {
       g_object_unref (memtex);
@@ -393,8 +395,6 @@ gdk_save_png (GdkTexture *texture)
       return NULL;
     }
 
-  memtex = gdk_memory_texture_from_texture (texture, format);
-
   png_set_write_fn (png, &io, png_write_func, png_flush_func);
 
   png_set_IHDR (png, info, width, height, depth,


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