[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-192-g5618ef004
wwp at claws-mail.org
wwp at claws-mail.org
Thu Sep 16 00:18:56 CEST 2021
The branch, gtk3 has been updated
via 5618ef004fa350901e9b09fb9c742b6216dfc5d0 (commit)
via aac70d4d6c172d5a82ea106d47a8b9e24b642602 (commit)
from f3e0150378312900ca1b05b3c94fdcd22fdfcacc (commit)
Summary of changes:
src/common/file-utils.c | 49 +++++++++++++++++++++++++------------------------
1 file changed, 25 insertions(+), 24 deletions(-)
- Log -----------------------------------------------------------------
commit 5618ef004fa350901e9b09fb9c742b6216dfc5d0
Author: wwp <subscript at free.fr>
Date: Thu Sep 16 00:18:50 2021 +0200
Fix CID 1491202, 1491126, 1491156 and 1491142: resource leaks. And
simplify the copy algorithm a bit (mostly around error checking).
diff --git a/src/common/file-utils.c b/src/common/file-utils.c
index 8591ad004..569ffda15 100644
--- a/src/common/file-utils.c
+++ b/src/common/file-utils.c
@@ -742,9 +742,9 @@ gint copy_dir(const gchar *src, const gchar *dst)
r = copy_file(old_file, new_file, TRUE);
}
#ifndef G_OS_WIN32
- /* Windows has no symlinks. Or well, Vista seems to
- have something like this but the semantics might be
- different. Thus we don't use it under Windows. */
+ /* Windows has no symlinks. Or well, Vista seems to
+ have something like this but the semantics might be
+ different. Thus we don't use it under Windows. */
else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
GError *error = NULL;
gchar *target = g_file_read_link(old_file, &error);
commit aac70d4d6c172d5a82ea106d47a8b9e24b642602
Author: wwp <subscript at free.fr>
Date: Thu Sep 16 00:16:19 2021 +0200
Fix CID 1491202, 1491126, 1491156 and 1491142: resource leaks. And
simplify the copy algorithm a bit (mostly around error checking).
diff --git a/src/common/file-utils.c b/src/common/file-utils.c
index 441d8fbd1..8591ad004 100644
--- a/src/common/file-utils.c
+++ b/src/common/file-utils.c
@@ -727,44 +727,45 @@ gint copy_dir(const gchar *src, const gchar *dst)
return -1;
}
- if (make_dir(dst) < 0)
+ if (make_dir(dst) < 0) {
+ g_dir_close(dir);
return -1;
+ }
while ((name = g_dir_read_name(dir)) != NULL) {
gchar *old_file, *new_file;
+ gint r = 0;
old_file = g_strconcat(src, G_DIR_SEPARATOR_S, name, NULL);
new_file = g_strconcat(dst, G_DIR_SEPARATOR_S, name, NULL);
debug_print("copying: %s -> %s\n", old_file, new_file);
if (g_file_test(old_file, G_FILE_TEST_IS_REGULAR)) {
- gint r = copy_file(old_file, new_file, TRUE);
- if (r < 0) {
- g_dir_close(dir);
- return r;
- }
- }
+ r = copy_file(old_file, new_file, TRUE);
+ }
#ifndef G_OS_WIN32
- /* Windows has no symlinks. Or well, Vista seems to
- have something like this but the semantics might be
- different. Thus we don't use it under Windows. */
- else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
+ /* Windows has no symlinks. Or well, Vista seems to
+ have something like this but the semantics might be
+ different. Thus we don't use it under Windows. */
+ else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
GError *error = NULL;
- gint r = 0;
gchar *target = g_file_read_link(old_file, &error);
- if (target)
+ if (error) {
+ g_warning("couldn't read link: %s", error->message);
+ g_error_free(error);
+ }
+ if (target) {
r = symlink(target, new_file);
- g_free(target);
- if (r < 0) {
- g_dir_close(dir);
- return r;
+ g_free(target);
}
- }
+ }
#endif /*G_OS_WIN32*/
- else if (g_file_test(old_file, G_FILE_TEST_IS_DIR)) {
- gint r = copy_dir(old_file, new_file);
- if (r < 0) {
- g_dir_close(dir);
- return r;
- }
+ else if (g_file_test(old_file, G_FILE_TEST_IS_DIR)) {
+ r = copy_dir(old_file, new_file);
+ }
+ g_free(old_file);
+ g_free(new_file);
+ if (r < 0) {
+ g_dir_close(dir);
+ return r;
}
}
g_dir_close(dir);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list