[Commits] [SCM] claws branch, master, updated. 3.16.0-254-gb9c4e27

ticho at claws-mail.org ticho at claws-mail.org
Fri Aug 3 14:02:53 CEST 2018


The branch, master has been updated
       via  b9c4e27fafe412c076fb600680b4374a2e140405 (commit)
      from  b9a58ed5fb712424026b3e71e2ba42d6859f4fcd (commit)

Summary of changes:
 src/summaryview.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit b9c4e27fafe412c076fb600680b4374a2e140405
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Aug 3 14:02:38 2018 +0200

    Fix a memory leak in summary_set_header().

diff --git a/src/summaryview.c b/src/summaryview.c
index 9bf4420..306972c 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -3481,9 +3481,16 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[],
 	if (!to_text)
 		to_text = _("(No Recipient)");
 	else {
-		if (prefs_common.summary_from_show == SHOW_NAME)
-			to_text = procheader_get_fromname(to_text);
-		else if (prefs_common.summary_from_show == SHOW_ADDR)
+		if (prefs_common.summary_from_show == SHOW_NAME) {
+			gchar *tmp = procheader_get_fromname(to_text);
+			/* need to keep to_text pointing to stack, so heap-allocated
+			 * string from procheader_get_fromname() will be copied to buf */
+			if (tmp != NULL) {
+				strncpy2(buf, tmp, sizeof(buf));
+				g_free(tmp);
+				to_text = buf;
+			}
+		} else if (prefs_common.summary_from_show == SHOW_ADDR)
 			extract_address(to_text);
 	}
 
@@ -3493,6 +3500,8 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[],
 	} else {
 		if (prefs_common.use_addr_book) {
 			gchar *tmp = summary_complete_address(to_text);
+			/* need to keep to_text pointing to stack, so heap-allocated
+			 * string from summary_complete_address() will be copied to buf */
 			if (tmp) {
 				strncpy2(buf, tmp, sizeof(buf));
 				g_free(tmp);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list