aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-utils.c
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2008-04-28 13:36:20 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2008-04-28 13:36:20 +0800
commit29d5ce762e725d1e6ac69efb02f13b64e98732aa (patch)
tree59efaca1138433a44b25856f55755371432f29f5 /mail/em-utils.c
parent87307d86390edb84adbe686073c00a8294ecb827 (diff)
downloadgsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar.gz
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar.bz2
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar.lz
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar.xz
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.tar.zst
gsoc2013-evolution-29d5ce762e725d1e6ac69efb02f13b64e98732aa.zip
Avoid crash while detecting mime types.
2008-04-28 Srinivasa Ragavan <sragavan@novell.com> * mail/em-utils.c: Avoid crash while detecting mime types. svn path=/trunk/; revision=35426
Diffstat (limited to 'mail/em-utils.c')
-rw-r--r--mail/em-utils.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 73379af0ed..5efa38a9cc 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2240,6 +2240,7 @@ em_utils_snoop_type(CamelMimePart *part)
* that instead and if it returns "application/octet-stream"
* try to do better with the filename check.
*/
+ CamelStream *mem;
if (magic_type) {
if (name_type
@@ -2261,12 +2262,14 @@ em_utils_snoop_type(CamelMimePart *part)
if (!types_cache)
types_cache = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL);
- tmp = g_hash_table_lookup (types_cache, res);
- if (tmp) {
- g_free (res);
- res = tmp;
- } else {
- g_hash_table_insert (types_cache, res, res);
+ if (res) {
+ tmp = g_hash_table_lookup (types_cache, res);
+ if (tmp) {
+ g_free (res);
+ res = tmp;
+ } else {
+ g_hash_table_insert (types_cache, res, res);
+ }
}
return res;