From 0b94e1fcf335f0131e5ff81cbe87b2e9ac343ab6 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Wed, 27 Feb 2008 17:58:26 +0000 Subject: [PATCH] Duplicate mime_type string before freeing it so that it doesn't always 2008-02-27 Carlos Garcia Campos * libdocument/ev-document-factory.c: (get_mime_type_from_uri): Duplicate mime_type string before freeing it so that it doesn't always fail when getting mime type from uri. Fixes bug #518874. svn path=/trunk/; revision=2931 --- ChangeLog | 7 +++++++ libdocument/ev-document-factory.c | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41c94bb6..1517b4b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-02-27 Carlos Garcia Campos + + * libdocument/ev-document-factory.c: (get_mime_type_from_uri): + + Duplicate mime_type string before freeing it so that it doesn't + always fail when getting mime type from uri. Fixes bug #518874. + 2008-02-27 Carlos Garcia Campos * shell/ev-view.c: (ev_view_form_field_choice_changed): diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c index 5b2473f5..962f42a6 100644 --- a/libdocument/ev-document-factory.c +++ b/libdocument/ev-document-factory.c @@ -106,9 +106,9 @@ get_compression_from_mime_type (const gchar *mime_type) static gchar * get_mime_type_from_uri (const gchar *uri) { - GFile *file; - GFileInfo *file_info; - const gchar *mime_type; + GFile *file; + GFileInfo *file_info; + gchar *mime_type; file = g_file_new_for_uri (uri); file_info = g_file_query_info (file, @@ -119,10 +119,10 @@ get_mime_type_from_uri (const gchar *uri) if (file_info == NULL) return NULL; - mime_type = g_file_info_get_content_type (file_info); + mime_type = g_strdup (g_file_info_get_content_type (file_info)); g_object_unref (file_info); - return g_strdup (mime_type); + return mime_type; } static gchar * @@ -169,7 +169,7 @@ get_document_from_uri (const char *uri, mime_type = slow ? get_mime_type_from_data (uri) : get_mime_type_from_uri (uri); - + if (mime_type == NULL) { g_set_error (error, EV_DOCUMENT_ERROR, -- 2.43.5