[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-279-gc75453be8

wwp at claws-mail.org wwp at claws-mail.org
Thu Sep 30 20:09:09 CEST 2021


The branch, gtk3 has been updated
       via  c75453be80856def79d80ff03f22817c2f7033fa (commit)
      from  84ce49b634b869e01a5ee084e4cd8efc8bda0c72 (commit)

Summary of changes:
 src/compose.c | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit c75453be80856def79d80ff03f22817c2f7033fa
Author: wwp <subscript at free.fr>
Date:   Thu Sep 30 20:08:21 2021 +0200

    Fix CID 1491120, 1491212, 1491255, 1491280, 1491284, 1491318: resource leaks.

diff --git a/src/compose.c b/src/compose.c
index 6c8294ef6..efb15a882 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2323,8 +2323,9 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 				if (orig_item != NULL) {
 					replyinfo = folder_item_get_msginfo_by_msgid(orig_item, tokens[2]);
 				}
-				g_strfreev(tokens);
 			}
+			if (tokens)
+				g_strfreev(tokens);
 			g_free(queueheader_buf);
 		}
 		if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, 
@@ -2335,8 +2336,9 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 				if (orig_item != NULL) {
 					fwdinfo = folder_item_get_msginfo_by_msgid(orig_item, tokens[2]);
 				}
-				g_strfreev(tokens);
 			}
+			if (tokens)
+				g_strfreev(tokens);
 			g_free(queueheader_buf);
 		}
 		/* Get manual headers */
@@ -2346,8 +2348,9 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 			if (listmh && *listmh != '\0') {
 				debug_print("Got manual headers: %s\n", listmh);
 				manual_headers = procheader_entries_from_str(listmh);
-				g_free(listmh);
 			}
+			if (listmh)
+				g_free(listmh);
 			g_free(queueheader_buf);
 		}
 	} else {
@@ -2359,11 +2362,14 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 		if (!procheader_get_header_from_msginfo(msginfo, &from, "FROM:")) {
 			extract_address(from);
 			account = account_find_from_address(from, FALSE);
-			g_free(from);
 		}
+		if (from)
+			g_free(from);
 	}
 	if (!account) {
 		account = cur_account;
+		if (manual_headers)
+			g_free(manual_headers);
 	}
 	cm_return_val_if_fail(account != NULL, NULL);
 
@@ -2422,6 +2428,8 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 	if (compose_parse_header(compose, msginfo) < 0) {
 		compose->updating = FALSE;
 		compose_destroy(compose);
+		if (manual_headers)
+			g_free(manual_headers);
 		return NULL;
 	}
 	compose_reedit_set_entry(compose, msginfo);
@@ -4163,8 +4171,10 @@ static gchar * compose_get_itemized_chars(GtkTextBuffer *buffer,
 	GString *item_chars = g_string_new("");
 	gchar *str = NULL;
 
-	if (gtk_text_iter_ends_line(&iter))
+	if (gtk_text_iter_ends_line(&iter)) {
+		g_string_free(item_chars, FALSE);
 		return NULL;
+	}
 
 	while (1) {
 		len++;
@@ -5688,7 +5698,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 {
 	GtkTextBuffer *buffer;
 	GtkTextIter start, end, tmp;
-	gchar *chars, *tmp_enc_file, *content;
+	gchar *chars, *tmp_enc_file = NULL, *content;
 	gchar *buf, *msg;
 	const gchar *out_codeset;
 	EncodingType encoding = ENC_UNKNOWN;
@@ -5971,10 +5981,14 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 			if (!privacy_encrypt(compose->privacy_system, mimemsg, compose->encdata)) {
 				debug_print("Couldn't encrypt mime structure: %s.\n",
 						privacy_get_error());
+				if (tmp_enc_file)
+					g_free(tmp_enc_file);
 				return COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED;
 			}
 		}
 	}
+	if (tmp_enc_file)
+		g_free(tmp_enc_file);
 
 	procmime_write_mimeinfo(mimemsg, fp);
 	
@@ -6524,10 +6538,12 @@ static gchar *compose_quote_list_of_addresses(gchar *str)
 		if (result == NULL)
 			result = g_strdup((faddr != NULL)? faddr: spec);
 		else {
-			result = g_strconcat(result,
+			gchar *tmp = g_strconcat(result,
 					     ", ",
 					     (faddr != NULL)? faddr: spec,
 					     NULL);
+			g_free(result);
+			result = tmp;
 		}
 		if (faddr != NULL) {
 			g_free(faddr);
@@ -10232,8 +10248,9 @@ static void compose_register_draft(MsgInfo *info)
 	FILE *fp = claws_fopen(filepath, "ab");
 	
 	if (fp) {
-		fprintf(fp, "%s\t%d\n", folder_item_get_identifier(info->folder), 
-				info->msgnum);
+		gchar *name = folder_item_get_identifier(info->folder);
+		fprintf(fp, "%s\t%d\n", name, info->msgnum);
+		g_free(name);
 		claws_fclose(fp);
 	}
 		

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list