[Commits] [SCM] claws branch, master, updated. 3.16.0-210-g859aa36

miras at claws-mail.org miras at claws-mail.org
Mon Jun 11 22:57:08 CEST 2018


The branch, master has been updated
       via  859aa36d3fa73b1ab573643950106ad8492197c6 (commit)
      from  b65c6e6fd2902768029e3273223cab456873d7a4 (commit)

Summary of changes:
 src/plugins/archive/libarchive_archive.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 859aa36d3fa73b1ab573643950106ad8492197c6
Author: Michael Rasmussen <mir at datanom.net>
Date:   Mon Jun 11 22:46:32 2018 +0200

    Fix a possible memory leak
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index 4ee3b6b..ed37ed5 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -589,7 +589,6 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 			set_progress_file_label(msg);
 			g_free(msg);
 #endif
-			entry = archive_entry_new();
 			if ((fd = g_open(filename, O_RDONLY, 0)) == -1) {
 				FILE_OP_ERROR(filename, "g_open");
 			}
@@ -597,6 +596,7 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 				if (g_stat(filename, &st) == -1) {
 					FILE_OP_ERROR(filename, "g_stat");
 				} else {
+					entry = archive_entry_new();
 					archive_entry_copy_stat(entry, &st);
 					archive_entry_set_pathname(entry, filename);
 					if (S_ISLNK(st.st_mode)) {
@@ -625,10 +625,10 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 							g_free(buf);
 						}
 					}
+					archive_entry_free(entry);
 				}
 				if (!g_close(fd, &err) || err)
 					FILE_OP_ERROR(filename, "g_close");
-				archive_entry_free(entry);
 			}
 		}
 		g_free(filename);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list