Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libdocument/ev-file-helpers.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2009-02-16 14:17:26 (GMT)
committer Christian Persch <chpe@src.gnome.org>2009-02-16 14:17:26 (GMT)
commit92e7db9e20993ee12ee5c1a51d8e9641a15e5b52 (patch)
treea8da0671a59b23eab0991ac693d9831511f39501 /libdocument/ev-file-helpers.c
parentc345e142d321c13bdbb795a784b63f75851a4ea9 (diff)
Fix a freed memory read.
* libdocument/ev-file-helpers.c: (get_mime_type_from_uri): Fix a freed memory read. svn path=/trunk/; revision=3472
Diffstat (limited to 'libdocument/ev-file-helpers.c')
-rw-r--r--libdocument/ev-file-helpers.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index 7b9a9e9..67e884a 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -222,6 +222,7 @@ get_mime_type_from_uri (const gchar *uri, GError **error)
GFile *file;
GFileInfo *file_info;
const gchar *content_type;
+ gchar *mime_type = NULL;
file = g_file_new_for_uri (uri);
file_info = g_file_query_info (file,
@@ -233,12 +234,12 @@ get_mime_type_from_uri (const gchar *uri, GError **error)
return NULL;
content_type = g_file_info_get_content_type (file_info);
- g_object_unref (file_info);
-
- if (!content_type)
- return NULL;
+ if (content_type) {
+ mime_type = g_content_type_get_mime_type (content_type);
+ }
- return g_content_type_get_mime_type (content_type);
+ g_object_unref (file_info);
+ return mime_type;
}
static gchar *