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.
This is the valgrind output for gtk3-demo
after running the 'Images' demo:
==20316== 30,208 (56 direct, 30,152 indirect) bytes in 1 blocks are definitely lost in loss record 11,005 of 11,022
==20316== at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==20316== by 0x50D5338: g_malloc0 (gmem.c:132)
==20316== by 0x192701EF: gif_get_lzw (io-gif.c:440)
==20316== by 0x192701EF: gif_main_loop (io-gif.c:818)
==20316== by 0x19270957: gdk_pixbuf__gif_image_load_increment (io-gif.c:1048)
==20316== by 0x56E8460: gdk_pixbuf_loader_load_module (gdk-pixbuf-loader.c:467)
==20316== by 0x56E8F73: gdk_pixbuf_loader_eat_header_write (gdk-pixbuf-loader.c:489)
==20316== by 0x56E8F73: gdk_pixbuf_loader_write (gdk-pixbuf-loader.c:535)
==20316== by 0x4A24BD9: load_scalable_with_loader (gtkimage.c:919)
==20316== by 0x4A268B8: gtk_image_set_from_resource (gtkimage.c:1064)
==20316== by 0x4A26A09: gtk_image_new_from_resource (gtkimage.c:641)
==20316== by 0x42880F: do_images (images.c:385)
==20316== by 0x43AEFB: run_example_for_row (main.c:128)
==20316== by 0x43B004: row_activated_cb (main.c:944)
==20316== 176 bytes in 2 blocks are definitely lost in loss record 10,000 of 11,022
==20316== at 0x483980B: malloc (vg_replace_malloc.c:309)
==20316== by 0x50D52D0: g_malloc (gmem.c:102)
==20316== by 0x50ED414: g_slice_alloc (gslice.c:1024)
==20316== by 0x50EDA71: g_slice_alloc0 (gslice.c:1050)
==20316== by 0x51DBA8B: g_type_create_instance (gtype.c:1849)
==20316== by 0x51BA93E: g_object_new_internal (gobject.c:1937)
==20316== by 0x51BC1DC: g_object_new_with_properties (gobject.c:2105)
==20316== by 0x51BCB88: g_object_new (gobject.c:1777)
==20316== by 0x19271513: gdk_pixbuf_gif_anim_get_iter (io-gif-animation.c:158)
==20316== by 0x19271884: gdk_pixbuf_gif_anim_get_static_image (io-gif-animation.c:115)
==20316== by 0x19270383: gif_get_lzw (io-gif.c:506)
==20316== by 0x19270383: gif_main_loop (io-gif.c:818)
==20316== by 0x19270957: gdk_pixbuf__gif_image_load_increment (io-gif.c:1048)