[eog/gnome-3-16] EogImage: Fix leaked GError when loading an SVG fails



commit deabba49d0e78a7afc376a4799aba8b496e3f718
Author: Felix Riemann <friemann gnome org>
Date:   Sun Aug 21 15:32:31 2016 +0200

    EogImage: Fix leaked GError when loading an SVG fails
    
    Make sure the GError is not overwritten when closing the
    handle if loading already failed earlier on.
    This will handle SVG errors similar to errors from GdkPixbuf.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770197

 src/eog-image.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index b11c8cb..2812ebb 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -1163,7 +1163,7 @@ eog_image_real_load (EogImage *img,
                                        eog_image_set_xmp_data (img, md_reader);
 #endif
                                        set_metadata = FALSE;
-                                        priv->metadata_status = EOG_IMAGE_METADATA_READY;
+                                       priv->metadata_status = EOG_IMAGE_METADATA_READY;
                                }
 
                                if (data2read == EOG_IMAGE_DATA_EXIF)
@@ -1180,7 +1180,10 @@ eog_image_real_load (EogImage *img,
        if (read_image_data || read_only_dimension) {
 #ifdef HAVE_RSVG
                if (use_rsvg) {
-                       rsvg_handle_close (priv->svg, error);
+                       /* Ignore the error if loading failed earlier
+                        * as the error will already be set in that case */
+                       rsvg_handle_close (priv->svg,
+                                          (failed ? NULL : error));
                } else
 #endif
                if (failed) {
@@ -1191,8 +1194,8 @@ eog_image_real_load (EogImage *img,
                                 * images as well. */
                                g_clear_error (error);
                        }
-               }
-        }
+               }
+       }
 
        g_free (buffer);
 


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