Index: base/third_party/xdg_mime/xdgmime.c |
diff --git a/base/third_party/xdg_mime/xdgmime.c b/base/third_party/xdg_mime/xdgmime.c |
index c7b16bbca762f89aafa7a95e62d7ec0db4d96bf0..032200f69cc021f14af870686955c6f64ef6112f 100644 |
--- a/base/third_party/xdg_mime/xdgmime.c |
+++ b/base/third_party/xdg_mime/xdgmime.c |
@@ -558,13 +558,16 @@ 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) |
+ if (mime_type) { |
Lei Zhang
2015/04/16 18:31:35
So how about:
if (!mime_type)
mime_type = _xdg_
|
+ free (data); |
return mime_type; |
+ } |
- return _xdg_binary_or_text_fallback(data, bytes_read); |
+ mime_type = _xdg_binary_or_text_fallback(data, bytes_read); |
+ free (data); |
+ return mime_type; |
} |
const char * |