[eog] EogImage: Fix leaked GError when loading an SVG fails



commit 55036c6d55b06e82a480b559d59f5effae26399d
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 cf773f9..b968863 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -1096,7 +1096,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)
@@ -1113,7 +1113,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) {
@@ -1124,8 +1127,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]