aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/em-utils.c15
2 files changed, 13 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ca5f536275..45fc8d1b49 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,9 @@
2008-04-28 Srinivasa Ragavan <sragavan@novell.com>
+ * mail/em-utils.c: Avoid crash while detecting mime types.
+
+2008-04-28 Srinivasa Ragavan <sragavan@novell.com>
+
* mail/em-format-html.c: Fix the Mailer header display
2008-04-25 Milan Crha <mcrha@redhat.com>
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;