talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 859aa36d3fa73b1ab573643950106ad8492197c6
parent b65c6e6fd2902768029e3273223cab456873d7a4
Author: Michael Rasmussen <mir@datanom.net>
Date:   Mon, 11 Jun 2018 22:46:32 +0200

Fix a possible memory leak

Signed-off-by: Michael Rasmussen <mir@datanom.net>

Diffstat:
Msrc/plugins/archive/libarchive_archive.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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);