[gdk-pixbuf] GIF: Plug animation data and iterator leak



commit dd3aa9ed64a0a370c8150f98e849ffc6e73da827
Author: Sebastian Keller <skeller gnome org>
Date:   Mon Jan 27 02:59:35 2020 +0100

    GIF: Plug animation data and iterator leak
    
    The get_static_image() method for gifs is leaking an iterator and since
    the iterator has a reference to the animation, this results in all
    animation frames being leaked.

 gdk-pixbuf/io-gif-animation.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
index 49674fd2e..8335cdd76 100644
--- a/gdk-pixbuf/io-gif-animation.c
+++ b/gdk-pixbuf/io-gif-animation.c
@@ -105,6 +105,7 @@ gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation)
 {
         GdkPixbufGifAnim *gif_anim;
         GdkPixbufAnimationIter *iter;
+        GdkPixbuf *pixbuf;
         GTimeVal start_time = { 0, 0 };
 
         gif_anim = GDK_PIXBUF_GIF_ANIM (animation);
@@ -113,7 +114,10 @@ gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation)
                 return NULL;
 
         iter = gdk_pixbuf_gif_anim_get_iter (animation, &start_time);
-        return gdk_pixbuf_gif_anim_iter_get_pixbuf (iter);
+        pixbuf = gdk_pixbuf_gif_anim_iter_get_pixbuf (iter);
+        g_object_unref (iter);
+
+        return pixbuf;
 }
 G_GNUC_END_IGNORE_DEPRECATIONS
 


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