[Commits] [SCM] claws branch, master, updated. 3.18.0-224-gb3bc30c4a

wwp at claws-mail.org wwp at claws-mail.org
Thu Sep 30 21:37:30 CEST 2021


The branch, master has been updated
       via  b3bc30c4a5e120a0907ffc2a70680efd43d89330 (commit)
      from  10c688b98dd59359c517ea5d111f74300771abd0 (commit)

Summary of changes:
 src/mh.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit b3bc30c4a5e120a0907ffc2a70680efd43d89330
Author: wwp <subscript at free.fr>
Date:   Thu Sep 30 21:37:26 2021 +0200

    Fix CID 1491096, 1491263, 1491328, 1491348: resource leaks.

diff --git a/src/mh.c b/src/mh.c
index 42b0e49f4..bb77cd664 100644
--- a/src/mh.c
+++ b/src/mh.c
@@ -809,17 +809,26 @@ static gint mh_scan_tree(Folder *folder)
 		if (is_file_exist(dir)) { \
 			g_warning("file '%s' already exists, " \
 				    "can't create folder", dir); \
+			if (rootpath) \
+				g_free(rootpath); \
+			if (path) \
+				g_free(path); \
 			return -1; \
 		} \
-		if (make_dir_hier(dir) < 0) \
+		if (make_dir_hier(dir) < 0) { \
+			if (rootpath) \
+				g_free(rootpath); \
+			if (path) \
+				g_free(path); \
 			return -1; \
+		} \
 		debug_print("Created dir '%s'\n", dir); \
 	} \
 }
 
 static gint mh_create_tree(Folder *folder)
 {
-	gchar *rootpath, *f, *path;
+	gchar *rootpath, *f, *path = NULL;
 
 	cm_return_val_if_fail(folder != NULL, -1);
 
@@ -1042,6 +1051,7 @@ static gint mh_rename_folder(Folder *folder, FolderItem *item,
 	real_name = mh_filename_from_utf8(name);
 	newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, real_name, NULL);
 	g_free(real_name);
+	g_free(dirname);
 
 	if (g_rename(oldpath, newpath) < 0) {
 		FILE_OP_ERROR(oldpath, "rename");
@@ -1325,6 +1335,7 @@ static gchar *get_unseen_seq_name(void)
 			get_home_dir(), G_DIR_SEPARATOR_S,
 			".mh_profile", NULL);
 		FILE *fp = claws_fopen(profile_path, "r");
+		g_free(profile_path);
 		if (fp) {
 			while (claws_fgets(buf, sizeof(buf), fp) != NULL) {
 				if (!strncmp(buf, "Unseen-Sequence:", strlen("Unseen-Sequence:"))) {

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list