balsa r7891 - in trunk: . libbalsa src



Author: pawels
Date: Sun Mar 16 14:56:28 2008
New Revision: 7891
URL: http://svn.gnome.org/viewvc/balsa?rev=7891&view=rev

Log:
* src/balsa-mime-widget-text.c: plug a leak if gtkhtml disabled.
* libbalsa/mailbox_mbox.c: release all resources before disposing the mailbox.
* libbalsa/message.c (lbmsg_set_header): plug a leak.


Modified:
   trunk/ChangeLog
   trunk/libbalsa/mailbox_mbox.c
   trunk/libbalsa/message.c
   trunk/src/balsa-mime-widget-text.c

Modified: trunk/libbalsa/mailbox_mbox.c
==============================================================================
--- trunk/libbalsa/mailbox_mbox.c	(original)
+++ trunk/libbalsa/mailbox_mbox.c	Sun Mar 16 14:56:28 2008
@@ -65,6 +65,7 @@
 
 static void libbalsa_mailbox_mbox_class_init(LibBalsaMailboxMboxClass *klass);
 static void libbalsa_mailbox_mbox_init(LibBalsaMailboxMbox * mailbox);
+static void libbalsa_mailbox_mbox_dispose(GObject * object);
 
 static GMimeStream *libbalsa_mailbox_mbox_get_message_stream(LibBalsaMailbox *
 							     mailbox,
@@ -174,6 +175,7 @@
 	libbalsa_mailbox_mbox_remove_files;
 
     libbalsa_mailbox_local_class->get_info = lbm_mbox_get_info;
+    object_class->dispose = libbalsa_mailbox_mbox_dispose;
 }
 
 
@@ -183,6 +185,13 @@
 {
 }
 
+static void
+libbalsa_mailbox_mbox_dispose(GObject * object)
+{
+    if(MAILBOX_OPEN(LIBBALSA_MAILBOX(object)))
+	libbalsa_mailbox_mbox_close_mailbox(LIBBALSA_MAILBOX(object), FALSE);
+}
+
 static gint
 lbm_mbox_check_files(const gchar * path, gboolean create)
 {

Modified: trunk/libbalsa/message.c
==============================================================================
--- trunk/libbalsa/message.c	(original)
+++ trunk/libbalsa/message.c	Sun Mar 16 14:56:28 2008
@@ -900,7 +900,7 @@
 	 */
 	const GMimeContentType *content_type;
 	gchar *str;
-
+	g_return_if_fail(headers->content_type == NULL);
 	content_type = g_mime_object_get_content_type(mime_msg->mime_part);
 	str = g_mime_content_type_to_string(content_type);
 	headers->content_type = g_mime_content_type_new_from_string(str);
@@ -1113,25 +1113,30 @@
 	message->headers->date = g_mime_utils_header_decode_date(value, NULL);
     } else
     if (g_ascii_strcasecmp(name, "From") == 0) {
+	g_return_val_if_fail(message->headers->from == NULL, FALSE);
         message->headers->from = internet_address_parse_string(value);
     } else
     if (g_ascii_strcasecmp(name, "To") == 0) {
+	g_return_val_if_fail(message->headers->to_list == NULL, FALSE);
 	message->headers->to_list = internet_address_parse_string(value);
     } else
     if (g_ascii_strcasecmp(name, "In-Reply-To") == 0) {
 	libbalsa_message_set_in_reply_to_from_string(message, value);
     } else
     if (g_ascii_strcasecmp(name, "Message-ID") == 0) {
+	g_return_val_if_fail(message->message_id==NULL, FALSE);
 	message->message_id = g_mime_utils_decode_message_id(value);
     } else
     if (g_ascii_strcasecmp(name, "References") == 0) {
 	libbalsa_message_set_references_from_string(message, value);
     } else
-    if (g_ascii_strcasecmp(name, "Content-Type") == 0) {
+    if (message->headers->content_type == NULL &&
+	g_ascii_strcasecmp(name, "Content-Type") == 0) {
 	message->headers->content_type =
 	    g_mime_content_type_new_from_string(value);
     } else
     if (g_ascii_strcasecmp(name, "Disposition-Notification-To") == 0) {
+	g_return_val_if_fail(message->headers->dispnotify_to == NULL, FALSE);
         message->headers->dispnotify_to =
             internet_address_parse_string(value);
     } else

Modified: trunk/src/balsa-mime-widget-text.c
==============================================================================
--- trunk/src/balsa-mime-widget-text.c	(original)
+++ trunk/src/balsa-mime-widget-text.c	Sun Mar 16 14:56:28 2008
@@ -164,6 +164,7 @@
                                        GTK_POLICY_ALWAYS);
         return bm_widget_new_html(bm, mime_body, ptr, alloced);
 #else
+	g_free(ptr);
         return NULL;
 #endif
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]