[gdk-pixbuf] Fix a string leak



commit db341ce31da350968f46b1ff1e4c9b1f1fa1bd09
Author: William Jon McCann <jmccann redhat com>
Date:   Wed Aug 15 15:03:24 2012 -0400

    Fix a string leak
    
    And avoid a pointless second call when filename is NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681943

 gdk-pixbuf/gdk-pixbuf-io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 0106c47..e3ddb08 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -904,8 +904,10 @@ _gdk_pixbuf_get_module (guchar *buffer, guint size,
         gboolean uncertain;
 
         mime_type = g_content_type_guess (NULL, buffer, size, &uncertain);
-        if (uncertain)
+        if (uncertain && filename != NULL) {
+                g_free (mime_type);
                 mime_type = g_content_type_guess (filename, buffer, size, NULL);
+        }
 
         for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
                 GdkPixbufModule *module = (GdkPixbufModule *)modules->data;



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