[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-221-ge06ed0f01

wwp at claws-mail.org wwp at claws-mail.org
Sun Sep 26 19:15:33 CEST 2021


The branch, gtk3 has been updated
       via  e06ed0f0118b48dedef6c951680b55f25a038416 (commit)
      from  0951750b9e233de0d15ccfec0fb5f12bb5e33b8b (commit)

Summary of changes:
 src/summaryview.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit e06ed0f0118b48dedef6c951680b55f25a038416
Author: wwp <subscript at free.fr>
Date:   Sun Sep 26 19:14:30 2021 +0200

    Fix CID 1491140 (and strange design): free of stack-allocated memory.

diff --git a/src/summaryview.c b/src/summaryview.c
index ecb04ac53..ce3ce1cd7 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -4971,6 +4971,8 @@ void summary_save_as(SummaryView *summaryview)
 	gchar *src, *dest, *dest_default;
 	gchar *tmp;
 	gchar *filedir = NULL;
+	gchar *converted_filename = NULL;
+	gchar * filepath = NULL;
 
 	AlertValue aval = 0;
 
@@ -4986,27 +4988,27 @@ void summary_save_as(SummaryView *summaryview)
 	manage_window_focus_in(summaryview->window, NULL, NULL);
 
 	if (filename && !g_utf8_validate(filename, -1, NULL)) {
-		gchar *converted_filename = conv_codeset_strdup(filename,
+		converted_filename = conv_codeset_strdup(filename,
 					       conv_get_locale_charset_str(),
 					       CS_UTF_8);
 		if (!converted_filename) {
 			g_warning("summary_save_as(): failed to convert character set");
 		} else {
-			g_free(filename);
 			filename = converted_filename;
 		}
 	}
-
 	if (!filename)
 		return;
+
 	if (prefs_common.attach_save_dir && *prefs_common.attach_save_dir) {
-        gchar * f = g_strconcat(prefs_common.attach_save_dir, G_DIR_SEPARATOR_S,
+        filepath = g_strconcat(prefs_common.attach_save_dir, G_DIR_SEPARATOR_S,
 				   filename, NULL);
-        g_free(filename);
-        filename = f;
 	}
-	dest = filesel_select_file_save(_("Save as"), filename);
-    g_free(filename);
+	dest = filesel_select_file_save(_("Save as"), filepath ? filepath : filename);
+	if (filepath)
+		g_free(filepath);
+	if (converted_filename)
+		g_free(converted_filename);
 	if (!dest)
 		return;
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list