From: Thomas Leonard Date: Sat, 22 Sep 2012 11:05:51 +0000 (+0100) Subject: Fixed use-after-free in xdgmime X-Git-Url: https://repo.or.cz/w/rox-filer.git/commitdiff_plain/97f32448e491de3a824ce7e3723d3db9a80df12c Fixed use-after-free in xdgmime --- diff --git a/src/xdgmime.c b/src/xdgmime.c index c7b16bbc..6dc58c25 100644 --- a/src/xdgmime.c +++ b/src/xdgmime.c @@ -558,13 +558,13 @@ xdg_mime_get_mime_type_for_file (const char *file_name, mime_type = _xdg_mime_magic_lookup_data (global_magic, data, bytes_read, NULL, mime_types, n); - free (data); fclose (file); - if (mime_type) - return mime_type; + if (!mime_type) + mime_type = _xdg_binary_or_text_fallback(data, bytes_read); - return _xdg_binary_or_text_fallback(data, bytes_read); + free (data); + return mime_type; } const char *