[Commits] [SCM] claws branch, master, updated. 3.9.3-72-g7445f4f

colin at claws-mail.org colin at claws-mail.org
Mon Apr 21 10:01:58 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  7445f4f8674ea0a02e4baff42342b0d9f7754114 (commit)
       via  46063c48ccc0d379e546946563e5047775d62640 (commit)
       via  f933992350613b35e5181fee532f1415e166fefb (commit)
       via  e240402b874071ffafe74aaffe60c177cb798567 (commit)
       via  f69b3bab9d66372a56e19867f458c3012aefd141 (commit)
      from  ec7df218a75fd5312211513867d986ed8d07f8fc (commit)


- Log -----------------------------------------------------------------
commit 7445f4f8674ea0a02e4baff42342b0d9f7754114
Author: Colin Leroy <colin at colino.net>
Date:   Mon Apr 21 10:01:39 2014 +0200

    Fix bug #3150, "etpan_certificate_check() leaks memory"

diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
index b71e4d7..ad5e3b3 100644
--- a/src/etpan/imap-thread.c
+++ b/src/etpan/imap-thread.c
@@ -536,13 +536,16 @@ static int etpan_certificate_check(const unsigned char *certificate, int len, vo
 	tmp.size = len;
 	gnutls_x509_crt_init(&cert);
 	if (gnutls_x509_crt_import(cert, &tmp, GNUTLS_X509_FMT_DER) < 0) {
+		free(tmp.data);
 		g_warning("IMAP: can't get cert\n");
 		return 0;
 	} else if (ssl_certificate_check(cert, (guint)-1, (gchar *)param->server,
 			(gushort)param->port) == TRUE) {
+		free(tmp.data);
 		gnutls_x509_crt_deinit(cert);
 		return 0;
 	} else {
+		free(tmp.data);
 		gnutls_x509_crt_deinit(cert);
 		return -1;
 	}

commit 46063c48ccc0d379e546946563e5047775d62640
Author: Colin Leroy <colin at colino.net>
Date:   Mon Apr 21 10:00:55 2014 +0200

    Fix bug #3148, "Logic error in claws_get_socket_name()"

diff --git a/src/main.c b/src/main.c
index 70f8da4..c2bcaff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2137,6 +2137,8 @@ gchar *claws_get_socket_name(void)
 
 	if (filename == NULL) {
 		struct stat st;
+		gint stat_ok;
+
 		socket_dir = g_strdup_printf("%s%cclaws-mail-%d",
 					   g_get_tmp_dir(), G_DIR_SEPARATOR,
 #if HAVE_GETUID
@@ -2144,10 +2146,11 @@ gchar *claws_get_socket_name(void)
 #else
 					   0);
 #endif
-		if (stat(socket_dir, &st) < 0 && errno != ENOENT) {
+		stat_ok = stat(socket_dir, &st);
+		if (stat_ok < 0 && errno != ENOENT) {
 			g_print("Error stat'ing socket_dir %s: %s\n",
 				socket_dir, strerror(errno));
-		} else if (S_ISSOCK(st.st_mode)) {
+		} else if (stat_ok == 0 && S_ISSOCK(st.st_mode)) {
 			/* old versions used a sock in $TMPDIR/claws-mail-$UID */
 			debug_print("Using legacy socket %s\n", socket_dir);
 			filename = g_strdup(socket_dir);

commit f933992350613b35e5181fee532f1415e166fefb
Author: Colin Leroy <colin at colino.net>
Date:   Mon Apr 21 10:00:25 2014 +0200

    Fix bug #3147, "verify_folderlist_xml() leaks memory"

diff --git a/src/file_checker.c b/src/file_checker.c
index 0ecee42..d38e28c 100644
--- a/src/file_checker.c
+++ b/src/file_checker.c
@@ -109,6 +109,7 @@ static gboolean verify_folderlist_xml()
 			g_free(bak);
 		}
   	}
+	xml_free_tree(node);
 
 	return TRUE;
 }

commit e240402b874071ffafe74aaffe60c177cb798567
Author: Colin Leroy <colin at colino.net>
Date:   Mon Apr 21 09:59:11 2014 +0200

    Fix bug #3146, "Memory corruption when deleting a message from folder"
    Reference msginfo before passing to the mark_as_read_timeout deferred
    callback.

diff --git a/src/summaryview.c b/src/summaryview.c
index 2e80178..fe37768 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3536,13 +3536,13 @@ static int msginfo_mark_as_read_timeout(void *data)
 	MarkAsReadData *mdata = (MarkAsReadData *)data;
 	if (!mdata)
 		return FALSE;
-	
+
 	if (mdata->msginfo == summary_get_selected_msg(mdata->summaryview))
 		msginfo_mark_as_read(mdata->summaryview, mdata->msginfo,
-				     mdata->summaryview->selected); 
+				     mdata->summaryview->selected);
+	procmsg_msginfo_free(mdata->msginfo);
 
 	g_free(mdata);
-
 	return FALSE;	
 }
 
@@ -3619,7 +3619,7 @@ static void summary_display_msg_full(SummaryView *summaryview,
 		    prefs_common.mark_as_read_delay) {
 			MarkAsReadData *data = g_new0(MarkAsReadData, 1);
 			data->summaryview = summaryview;
-			data->msginfo = msginfo;
+			data->msginfo = procmsg_msginfo_new_ref(msginfo);
 #if GLIB_CHECK_VERSION(2,14,0)
 			g_timeout_add_seconds(prefs_common.mark_as_read_delay,
 				msginfo_mark_as_read_timeout, data);

commit f69b3bab9d66372a56e19867f458c3012aefd141
Author: Colin Leroy <colin at colino.net>
Date:   Mon Apr 21 09:57:52 2014 +0200

    Fix bug #3145, "Memory corruption in imap_disconnect_all"

diff --git a/src/imap.c b/src/imap.c
index ba4a480..d7b39db 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -124,6 +124,7 @@ struct _IMAPSession
 	gboolean busy;
 	gboolean cancelled;
 	gboolean sens_update_block;
+	gboolean do_destroy;
 };
 
 struct _IMAPNameSpace
@@ -578,6 +579,14 @@ static void imap_disc_session_destroy(IMAPSession *session)
 	SESSION(session)->sock = NULL;
 }
 
+static void imap_safe_destroy(IMAPSession *session)
+{
+	if (!session->busy)
+		session_destroy(SESSION(session));
+	else
+		session->do_destroy = TRUE;
+}
+
 static gboolean is_fatal(int libetpan_errcode)
 {
 	switch(libetpan_errcode) {
@@ -952,7 +961,7 @@ static IMAPSession *imap_reconnect_if_possible(Folder *folder, IMAPSession *sess
 		log_warning(LOG_PROTOCOL, _("Connecting to %s failed"),
 			    folder->account->recv_server);
 		SESSION(session)->sock = NULL;
-		session_destroy(SESSION(session));
+		imap_safe_destroy(session);
 		session = NULL;
 	} else {
 		rfolder->session = NULL;
@@ -964,7 +973,7 @@ static IMAPSession *imap_reconnect_if_possible(Folder *folder, IMAPSession *sess
 			    folder->account->recv_server);
 		SESSION(session)->state = SESSION_DISCONNECTED;
 		SESSION(session)->sock = NULL;
-		session_destroy(SESSION(session));
+		imap_safe_destroy(session);
 		/* Clear folders session to make imap_session_get create
 		   a new session, because of rfolder->session == NULL
 		   it will not try to reconnect again and so avoid an
@@ -994,11 +1003,21 @@ static IMAPSession *imap_session_get(Folder *folder)
 		return NULL;
 	}
 
+	/* check for deferred destroy */
+	if (rfolder->session != NULL) {
+		session = IMAP_SESSION(rfolder->session);
+		if (!session->busy && session->do_destroy) {
+			rfolder->session = NULL;
+			imap_safe_destroy(session);
+			session = NULL;
+		}
+	}
+
 	/* Make sure we have a session */
 	if (rfolder->session != NULL && rfolder->session->state != SESSION_DISCONNECTED) {
 		session = IMAP_SESSION(rfolder->session);
 	} else if (rfolder->session != NULL && rfolder->session->state == SESSION_DISCONNECTED) {
-		session_destroy(SESSION(rfolder->session));
+		imap_safe_destroy(IMAP_SESSION(rfolder->session));
 		rfolder->session = NULL;
 		goto new_conn;
 	} else if (rfolder->connecting) {
@@ -1028,7 +1047,7 @@ new_conn:
 			imap_threaded_disconnect(session->folder);
 			SESSION(session)->state = SESSION_DISCONNECTED;
 			SESSION(session)->sock = NULL;
-			session_destroy(SESSION(session));
+			imap_safe_destroy(session);
 		}
 		rfolder->last_failure = time(NULL);
 		rfolder->connecting = FALSE;
@@ -1187,7 +1206,7 @@ static IMAPSession *imap_session_new(Folder * folder,
 			log_warning(LOG_PROTOCOL, _("Can't start TLS session.\n"));
 			if (!is_fatal(ok)) {
 				SESSION(session)->sock = NULL;
-				session_destroy(SESSION(session));
+				imap_safe_destroy(session);
 			}
 			return NULL;
 		}
@@ -5844,12 +5863,15 @@ void imap_disconnect_all(gboolean have_connectivity)
 		if (account->protocol == A_IMAP4) {
 			RemoteFolder *folder = (RemoteFolder *)account->folder;
 			if (folder && folder->session) {
+				if (imap_is_busy(FOLDER(folder)))
+					imap_threaded_cancel(FOLDER(folder));
+
 				IMAPSession *session = (IMAPSession *)folder->session;
 				if (have_connectivity)
 					imap_threaded_disconnect(FOLDER(folder));
 				SESSION(session)->state = SESSION_DISCONNECTED;
 				SESSION(session)->sock = NULL;
-				session_destroy(SESSION(session));
+				imap_safe_destroy(session);
 				folder->session = NULL;
 			}
 		}

-----------------------------------------------------------------------

Summary of changes:
 src/etpan/imap-thread.c |    3 +++
 src/file_checker.c      |    1 +
 src/imap.c              |   34 ++++++++++++++++++++++++++++------
 src/main.c              |    7 +++++--
 src/summaryview.c       |    8 ++++----
 5 files changed, 41 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list