summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2021-12-06 17:52:59 -0800
committerMarge Bot <marge-bot@gnome.org>2021-12-07 15:23:35 +0000
commit0f353b22a629c73a61122e815c63525ee7f7ad18 (patch)
tree7ca66fa15038e845dac48e4e32ba2d7eb7feb484 /lib
parente12cdc0835d79be31b78e8f00f4cc7a77c31816d (diff)
downloadepiphany-0f353b22a629c73a61122e815c63525ee7f7ad18.tar.gz
file-helpers: Fix a memory leak of GFileInfo
Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1042>
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-file-helpers.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index a2e3ab645..ea4eab061 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -868,7 +868,6 @@ ephy_copy_directory (const char *source,
if (type == G_FILE_TYPE_DIRECTORY) {
g_autoptr (GFileEnumerator) enumerator = NULL;
- g_autoptr (GFileInfo) info = NULL;
if (!g_file_make_directory_with_parents (dest_file, NULL, &error)) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
@@ -890,7 +889,10 @@ ephy_copy_directory (const char *source,
return;
}
- for (info = g_file_enumerator_next_file (enumerator, NULL, NULL); info != NULL; info = g_file_enumerator_next_file (enumerator, NULL, NULL)) {
+ for (;;) {
+ g_autoptr (GFileInfo) info = g_file_enumerator_next_file (enumerator, NULL, NULL);
+ if (!info)
+ break;
ephy_copy_directory (
g_build_filename (source, g_file_info_get_name (info), NULL),
g_build_filename (target, g_file_info_get_name (info), NULL));