[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-230-g5d9d64f08

wwp at claws-mail.org wwp at claws-mail.org
Sun Sep 26 21:45:26 CEST 2021


The branch, gtk3 has been updated
       via  5d9d64f080b718f6754dd8a23dadfba8b447ec2c (commit)
      from  d172fae34524d34f1b31bc8c9bd4a3cad847f94c (commit)

Summary of changes:
 src/prefs_account.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 5d9d64f080b718f6754dd8a23dadfba8b447ec2c
Author: wwp <subscript at free.fr>
Date:   Sun Sep 26 21:43:57 2021 +0200

    Fix CID 1491337, 1491317 and 1491101: resource leak, use after free.

diff --git a/src/prefs_account.c b/src/prefs_account.c
index 7a9de7275..21e484e6a 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -3591,11 +3591,15 @@ static gint prefs_basic_apply(void)
 	
 	if (strchr(gtk_entry_get_text(GTK_ENTRY(basic_page.uid_entry)), '\n') != NULL) {
 		alertpanel_error(_("User ID cannot contain a newline character."));
+		if (old_id)
+			g_free(old_id);
 		return -1;
 	}
 
 	if (strchr(gtk_entry_get_text(GTK_ENTRY(basic_page.pass_entry)), '\n') != NULL) {
 		alertpanel_error(_("Password cannot contain a newline character."));
+		if (old_id)
+			g_free(old_id);
 		return -1;
 	}
 
@@ -3616,8 +3620,10 @@ static gint prefs_basic_apply(void)
 				tmp_ac_prefs.account_name);
 		if (old_id != NULL && new_id != NULL)
 			prefs_filtering_rename_path(old_id, new_id);
-		g_free(old_id);
-		g_free(new_id);
+		if (old_id)
+			g_free(old_id);
+		if (new_id)
+			g_free(new_id);
 	}
 	
 	return 0;
@@ -4476,16 +4482,17 @@ void prefs_account_write_config_all(GList *account_list)
 		g_free(rcpath);
 		return;
 	}
-	g_free(rcpath);
 
 	for (cur = account_list; cur != NULL; cur = cur->next) {
 		GString *str;
 
 		tmp_ac_prefs = *(PrefsAccount *)cur->data;
 		if (fprintf(pfile->fp, "[Account: %d]\n",
-			    tmp_ac_prefs.account_id) <= 0)
+			    tmp_ac_prefs.account_id) <= 0) {
+			g_free(pfile);
 			return;
-
+        }
+        
 		str = g_string_sized_new(32);
 		g_hash_table_foreach(tmp_ac_prefs.privacy_prefs, create_privacy_prefs, str);
 		privacy_prefs = str->str;		    
@@ -4509,10 +4516,12 @@ void prefs_account_write_config_all(GList *account_list)
 			if (claws_fputc('\n', pfile->fp) == EOF) {
 				FILE_OP_ERROR(rcpath, "claws_fputc");
 				prefs_file_close_revert(pfile);
+				g_free(rcpath);
 				return;
 			}
 		}
 	}
+	g_free(rcpath);
 
 	if (prefs_file_close(pfile) < 0)
 		g_warning("failed to write configuration to file");

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list