diff options
author | Dan Winship <danw@src.gnome.org> | 2000-08-14 04:49:28 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-08-14 04:49:28 +0800 |
commit | 184ad0a7f66f5d549fa6f1e2acaaa87592190c33 (patch) | |
tree | 576a27db39fff973654a9b672e43569f960ed12b /mail | |
parent | 3ff93be29af88808d2552a5bafd8db1980dc6cb2 (diff) | |
download | gsoc2013-evolution-184ad0a7f66f5d549fa6f1e2acaaa87592190c33.tar.gz gsoc2013-evolution-184ad0a7f66f5d549fa6f1e2acaaa87592190c33.tar.zst gsoc2013-evolution-184ad0a7f66f5d549fa6f1e2acaaa87592190c33.zip |
Fix some freed-memory references
* mail-format.c (add_url): Fix some freed-memory references
svn path=/trunk/; revision=4806
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 2 | ||||
-rw-r--r-- | mail/mail-format.c | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index b8416ff95b..3ae6f9de2a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,7 @@ 2000-08-13 Dan Winship <danw@helixcode.com> + * mail-format.c (add_url): Fix some freed-memory references + * mail-threads.c (get_password): Don't free the prompt. It doesn't belong to you. diff --git a/mail/mail-format.c b/mail/mail-format.c index 36ce4d9b86..f9739b911e 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -109,18 +109,21 @@ free_urls (gpointer urls) g_hash_table_destroy (urls); } -static void +static char * add_url (char *url, gpointer data, MailDisplay *md) { GHashTable *urls; gpointer old_key, old_value; urls = g_datalist_get_data (md->data, "urls"); - g_return_if_fail (urls != NULL); + g_return_val_if_fail (urls != NULL, NULL); - if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) - g_free (old_key); + if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) { + g_free (url); + url = old_key; + } g_hash_table_insert (urls, url, data); + return url; } /** @@ -218,9 +221,7 @@ get_url_for_icon (const char *icon_name, MailDisplay *md) g_free (icon_path); url = g_strdup_printf ("x-evolution-data:%p", ba); - add_url (url, ba, md); - - return url; + return add_url (url, ba, md); } @@ -967,12 +968,12 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type, g_string_free (string, TRUE); xed = g_strdup_printf ("x-evolution-data:%p", part); - add_url (xed, ba, md); - camel_object_hook_event (CAMEL_OBJECT (md->current_message), - "finalize", free_byte_array, ba); mail_html_write (md->html, md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no>" "</iframe>", xed); + add_url (xed, ba, md); + camel_object_hook_event (CAMEL_OBJECT (md->current_message), + "finalize", free_byte_array, ba); return TRUE; } @@ -1523,9 +1524,8 @@ handle_via_external (CamelMimePart *part, const char *mime_type, icon = "gnome-unknown.png"; action = g_strdup_printf ("open the file in %s", app->name); url = g_strdup_printf ("x-evolution-external:%s", app->command); - add_url (url, part, md); - handle_mystery (part, md, url, icon, desc, action); + add_url (url, part, md); g_free (action); |