Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1388)

Side by Side Diff: base/third_party/xdg_mime/free_poiner_later.patch

Issue 1037023002: Do not free pointer when you are going to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added patch and modified README Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 diff --git a/base/third_party/xdg_mime/xdgmime.c b/base/third_party/xdg_mime/xdg mime.c
2 index c7b16bb..032200f 100644
3 --- a/base/third_party/xdg_mime/xdgmime.c
4 +++ b/base/third_party/xdg_mime/xdgmime.c
5 @@ -558,13 +558,16 @@ xdg_mime_get_mime_type_for_file (const char *file_name,
6 mime_type = _xdg_mime_magic_lookup_data (global_magic, data, bytes_read, NULL ,
7 mime_types, n);
8
9 - free (data);
10 fclose (file);
11
12 - if (mime_type)
13 + if (mime_type) {
14 + free (data);
15 return mime_type;
16 + }
17
18 - return _xdg_binary_or_text_fallback(data, bytes_read);
19 + mime_type = _xdg_binary_or_text_fallback(data, bytes_read);
20 + free (data);
21 + return mime_type;
22 }
23
24 const char *
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698