[Commits] [SCM] claws branch, master, updated. 3.13.2-21-gcd7f85f

ticho at claws-mail.org ticho at claws-mail.org
Mon Feb 8 18:28:32 CET 2016


The branch, master has been updated
       via  cd7f85f7eb6db97e86a8830e28116d26223d4e26 (commit)
       via  14b55b5122349d18fa15f3b10c1067f19657ca10 (commit)
      from  503cb50edf1d194b96f1764a9d565166e2639b19 (commit)

Summary of changes:
 src/action.c                        |    2 +-
 src/compose.c                       |    8 ++++----
 src/folder.c                        |    4 ++--
 src/matcher.c                       |    6 +++---
 src/mimeview.c                      |    4 ++--
 src/plugins/clamd/clamav_plugin.c   |    2 +-
 src/plugins/pgpinline/pgpinline.c   |    2 +-
 src/plugins/pgpmime/pgpmime.c       |    4 ++--
 src/plugins/smime/smime.c           |    6 +++---
 src/plugins/tnef_parse/tnef_parse.c |   12 ++++++------
 src/privacy.c                       |    2 +-
 src/procmime.c                      |   20 +++++++++++---------
 src/procmime.h                      |    2 +-
 src/procmsg.c                       |    3 ++-
 14 files changed, 40 insertions(+), 37 deletions(-)


- Log -----------------------------------------------------------------
commit cd7f85f7eb6db97e86a8830e28116d26223d4e26
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Feb 8 18:26:26 2016 +0100

    Real fix for #3598. We were zeroing out wrong pointer.

diff --git a/src/procmsg.c b/src/procmsg.c
index 153da63..aa3c9a8 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -1431,7 +1431,8 @@ void procmsg_msginfo_free(MsgInfo **msginfo_ptr)
 
 	FREENULL(msginfo->plaintext_file);
 
-	FREENULL(msginfo);
+	g_free(msginfo);
+	*msginfo_ptr = NULL;
 }
 #undef FREENULL
 

commit 14b55b5122349d18fa15f3b10c1067f19657ca10
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Feb 8 18:26:49 2016 +0100

    Make procmime_mimeinfo_free_all() zero the passed pointer.
    
    The function's argument type changes from MimeInfo* to MimeInfo**,
    so that we can zero out the pointer.
    
    This closes bug #3610, reported by Hanno Boeck.

diff --git a/src/action.c b/src/action.c
index e78bf47..57398f8 100644
--- a/src/action.c
+++ b/src/action.c
@@ -430,7 +430,7 @@ static gboolean parse_append_msgpart(GString *cmd, MsgInfo *msginfo,
 	ret = procmime_get_part(part_filename, partinfo);
 
 	if (single_part)
-		procmime_mimeinfo_free_all(partinfo);
+		procmime_mimeinfo_free_all(&partinfo);
 	g_free(filename);
 
 	if (ret < 0) {
diff --git a/src/compose.c b/src/compose.c
index f7d18a0..ee9ce30 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1535,7 +1535,7 @@ static void compose_extract_original_charset(Compose *compose)
 				g_strdup(procmime_mimeinfo_get_parameter(
 						partinfo, "charset"));
 		}
-		procmime_mimeinfo_free_all(mimeinfo);
+		procmime_mimeinfo_free_all(&mimeinfo);
 	}
 }
 
@@ -3877,7 +3877,7 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
 	if (!mimeinfo) return;
 
 	if (mimeinfo->node->children == NULL) {
-		procmime_mimeinfo_free_all(mimeinfo);
+		procmime_mimeinfo_free_all(&mimeinfo);
 		return;
 	}
 
@@ -3947,7 +3947,7 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
 		g_free(outfile);
 		NEXT_PART_NOT_CHILD(child);
 	}
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 }
 
 #undef NEXT_PART_NOT_CHILD
@@ -5795,7 +5795,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 
 	procmime_write_mimeinfo(mimemsg, fp);
 	
-	procmime_mimeinfo_free_all(mimemsg);
+	procmime_mimeinfo_free_all(&mimemsg);
 
 	return 0;
 }
diff --git a/src/folder.c b/src/folder.c
index f2237ec..bf286b3 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -2896,7 +2896,7 @@ gchar *folder_item_fetch_msg(FolderItem *item, gint num)
 			/* check for attachments */
 			if (mimeinfo != NULL) {	
 				g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_mime_flags, msginfo);
-				procmime_mimeinfo_free_all(mimeinfo);
+				procmime_mimeinfo_free_all(&mimeinfo);
 
 				procmsg_msginfo_set_flags(msginfo, 0, MSG_SCANNED);
 			}
@@ -2943,7 +2943,7 @@ gchar *folder_item_fetch_msg_full(FolderItem *item, gint num, gboolean headers,
 			/* check for attachments */
 			if (mimeinfo != NULL) {	
 				g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_mime_flags, msginfo);
-				procmime_mimeinfo_free_all(mimeinfo);
+				procmime_mimeinfo_free_all(&mimeinfo);
 
 				procmsg_msginfo_set_flags(msginfo, 0, MSG_SCANNED);
 			}
diff --git a/src/matcher.c b/src/matcher.c
index 6960093..f5d5f96 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -1707,18 +1707,18 @@ static gboolean matcherlist_match_body(MatcherList *matchers, gboolean body_only
 		if (partinfo->type == MIMETYPE_TEXT) {
 			first_text_found = TRUE;
 			if (matcherlist_match_text_content(matchers, partinfo)) {
-				procmime_mimeinfo_free_all(mimeinfo);
+				procmime_mimeinfo_free_all(&mimeinfo);
 				return TRUE;
 			}
 		} else if (matcherlist_match_binary_content(matchers, partinfo)) {
-			procmime_mimeinfo_free_all(mimeinfo);
+			procmime_mimeinfo_free_all(&mimeinfo);
 			return TRUE;
 		}
 
 		if (body_only && first_text_found)
 			break;
 	}
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	return FALSE;
 }
diff --git a/src/mimeview.c b/src/mimeview.c
index eb767b9..69e5906 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -530,7 +530,7 @@ static void mimeview_free_mimeinfo(MimeView *mimeview)
 		mimeview->check_data->free_after_use = TRUE;
 #endif
 	if (mimeview->mimeinfo != NULL && !defer) {
-		procmime_mimeinfo_free_all(mimeview->mimeinfo);
+		procmime_mimeinfo_free_all(&mimeview->mimeinfo);
 		mimeview->mimeinfo = NULL;
 	} else if (defer) {
 #ifdef USE_PTHREAD
@@ -1112,7 +1112,7 @@ static void mimeview_check_data_reset(MimeView *mimeview)
 
 	if (must_free) {
 		debug_print("freeing deferred mimeinfo\n");
-		procmime_mimeinfo_free_all(mimeview->check_data->siginfo);
+		procmime_mimeinfo_free_all(&mimeview->check_data->siginfo);
 	}
 
 	g_free(mimeview->check_data);
diff --git a/src/plugins/clamd/clamav_plugin.c b/src/plugins/clamd/clamav_plugin.c
index ae11d7f..751d3ca 100644
--- a/src/plugins/clamd/clamav_plugin.c
+++ b/src/plugins/clamd/clamav_plugin.c
@@ -193,7 +193,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
 		}
 	}
 	
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	return (result.status == OK) ? FALSE : TRUE;
 }
diff --git a/src/plugins/pgpinline/pgpinline.c b/src/plugins/pgpinline/pgpinline.c
index 7dc1502..dfe1ca7 100644
--- a/src/plugins/pgpinline/pgpinline.c
+++ b/src/plugins/pgpinline/pgpinline.c
@@ -437,7 +437,7 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
 	}
 
 	g_node_unlink(decinfo->node);
-	procmime_mimeinfo_free_all(parseinfo);
+	procmime_mimeinfo_free_all(&parseinfo);
 
 	decinfo->tmp = TRUE;
 
diff --git a/src/plugins/pgpmime/pgpmime.c b/src/plugins/pgpmime/pgpmime.c
index 670dfdc..5b8b190 100644
--- a/src/plugins/pgpmime/pgpmime.c
+++ b/src/plugins/pgpmime/pgpmime.c
@@ -410,7 +410,7 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
 	}
 
 	g_node_unlink(decinfo->node);
-	procmime_mimeinfo_free_all(parseinfo);
+	procmime_mimeinfo_free_all(&parseinfo);
 
 	decinfo->tmp = TRUE;
 
@@ -723,7 +723,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 
 	/* create encrypted multipart */
 	g_node_unlink(msgcontent->node);
-	procmime_mimeinfo_free_all(msgcontent);
+	procmime_mimeinfo_free_all(&msgcontent);
 	g_node_append(mimeinfo->node, encmultipart->node);
 
 	newinfo = procmime_mimeinfo_new();
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index c4d0d85..526a03e 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -296,7 +296,7 @@ static gint smime_check_signature(MimeInfo *mimeinfo)
 					return -1;
 
 				g_node_unlink(decinfo->node);
-				procmime_mimeinfo_free_all(newinfo);
+				procmime_mimeinfo_free_all(&newinfo);
 				decinfo->tmp = TRUE;
 				parentinfo = procmime_mimeinfo_parent(mimeinfo);
 
@@ -506,7 +506,7 @@ static MimeInfo *smime_decrypt(MimeInfo *mimeinfo)
 	}
 
 	g_node_unlink(decinfo->node);
-	procmime_mimeinfo_free_all(parseinfo);
+	procmime_mimeinfo_free_all(&parseinfo);
 
 	decinfo->tmp = TRUE;
 
@@ -861,7 +861,7 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
 	g_free(textstr);
 
 	/* create encrypted multipart */
-	procmime_mimeinfo_free_all(msgcontent);
+	procmime_mimeinfo_free_all(&msgcontent);
 	g_node_append(mimeinfo->node, encmultipart->node);
 
 	encmultipart->content = MIMECONTENT_FILE;
diff --git a/src/plugins/tnef_parse/tnef_parse.c b/src/plugins/tnef_parse/tnef_parse.c
index 4abd2c5..e694313 100644
--- a/src/plugins/tnef_parse/tnef_parse.c
+++ b/src/plugins/tnef_parse/tnef_parse.c
@@ -69,7 +69,7 @@ static MimeInfo *tnef_broken_mimeinfo(const gchar *reason)
 	fclose(fp);
 	if (g_stat(tmpfilename, &statbuf) < 0) {
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return NULL;
 
 	}
@@ -118,14 +118,14 @@ static MimeInfo *tnef_dump_file(const gchar *filename, char *data, size_t size)
 		FILE_OP_ERROR(tmpfilename, "fwrite");
 		fclose(fp);
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to write the part data."));
 	}
 	fclose(fp);
 
 	if (g_stat(tmpfilename, &statbuf) < 0) {
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to write the part data."));
 	} else {
 		sub_info->tmp = TRUE;
@@ -170,7 +170,7 @@ MimeInfo *tnef_parse_vcal(TNEFStruct *tnef)
 
 	if (!result) {
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to parse VCalendar data."));
 	}
 	return sub_info;
@@ -209,7 +209,7 @@ MimeInfo *tnef_parse_vtask(TNEFStruct *tnef)
 	}
 	if (!result) {
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to parse VTask data."));
 	}
 	return sub_info;
@@ -259,7 +259,7 @@ MimeInfo *tnef_parse_vcard(TNEFStruct *tnef)
 	
 	if (!result) {
 		claws_unlink(tmpfilename);
-		procmime_mimeinfo_free_all(sub_info);
+		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to parse VCard data."));
 	}
 	return sub_info;
diff --git a/src/privacy.c b/src/privacy.c
index ffc61ae..c63fbbd 100644
--- a/src/privacy.c
+++ b/src/privacy.c
@@ -307,7 +307,7 @@ static gint decrypt(MimeInfo *mimeinfo, PrivacySystem *system)
 	parentinfo = procmime_mimeinfo_parent(mimeinfo);
 	childnumber = g_node_child_index(parentinfo->node, mimeinfo);
 	
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	g_node_insert(parentinfo->node, childnumber, decryptedinfo->node);
 
diff --git a/src/procmime.c b/src/procmime.c
index bcb3db2..7823ccf 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -138,13 +138,12 @@ static gboolean free_func(GNode *node, gpointer data)
 	if (mimeinfo->privacy)
 		privacy_free_privacydata(mimeinfo->privacy);
 
-	g_free(mimeinfo);
-
 	return FALSE;
 }
 
-void procmime_mimeinfo_free_all(MimeInfo *mimeinfo)
+void procmime_mimeinfo_free_all(MimeInfo **mimeinfo_ptr)
 {
+	MimeInfo *mimeinfo = *mimeinfo_ptr;
 	GNode *node;
 
 	if (!mimeinfo)
@@ -154,6 +153,9 @@ void procmime_mimeinfo_free_all(MimeInfo *mimeinfo)
 	g_node_traverse(node, G_IN_ORDER, G_TRAVERSE_ALL, -1, free_func, NULL);
 
 	g_node_destroy(node);
+
+	g_free(mimeinfo);
+	*mimeinfo_ptr = NULL;
 }
 
 MimeInfo *procmime_mimeinfo_parent(MimeInfo *mimeinfo)
@@ -946,17 +948,17 @@ scan_again:
 		 * fully for non-empty parts
 		 */
 		short_scan = FALSE;
-		procmime_mimeinfo_free_all(mimeinfo);
+		procmime_mimeinfo_free_all(&mimeinfo);
 		goto scan_again;
 	} else if (!empty_ok && !short_scan) {
 		/* if full scan didn't find a non-empty part, rescan
 		 * accepting empty parts 
 		 */
 		empty_ok = TRUE;
-		procmime_mimeinfo_free_all(mimeinfo);
+		procmime_mimeinfo_free_all(&mimeinfo);
 		goto scan_again;
 	}
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	/* outfp already unlocked at this time */
 	return outfp;
@@ -1019,7 +1021,7 @@ FILE *procmime_get_first_encrypted_text_content(MsgInfo *msginfo)
 	if (partinfo)
 		outfp = procmime_get_text_content(partinfo);
 
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	/* outfp already unlocked at this time */
 	return outfp;
@@ -1039,7 +1041,7 @@ gboolean procmime_msginfo_is_encrypted(MsgInfo *msginfo)
 
 	partinfo = mimeinfo;
 	result = (find_encrypted_part(partinfo) != NULL);
-	procmime_mimeinfo_free_all(mimeinfo);
+	procmime_mimeinfo_free_all(&mimeinfo);
 
 	return result;
 }
@@ -2043,7 +2045,7 @@ static int procmime_parse_mimepart(MimeInfo *parent,
 			 * this avoids DOSsing ourselves 
 			 * with enormous messages
 			 */
-			procmime_mimeinfo_free_all(mimeinfo);
+			procmime_mimeinfo_free_all(&mimeinfo);
 			return -1;			
 		}
 		g_node_append(parent->node, mimeinfo->node);
diff --git a/src/procmime.h b/src/procmime.h
index 6f82857..5fae87a 100644
--- a/src/procmime.h
+++ b/src/procmime.h
@@ -159,7 +159,7 @@ extern "C" {
 /* MimeInfo handling */
 
 MimeInfo *procmime_mimeinfo_new		(void);
-void procmime_mimeinfo_free_all		(MimeInfo	*mimeinfo);
+void procmime_mimeinfo_free_all		(MimeInfo	**mimeinfo_ptr);
 
 MimeInfo *procmime_mimeinfo_insert	(MimeInfo	*parent,
 					 MimeInfo	*mimeinfo);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list