[epiphany] file-helpers: Fix a memory leak of GFileInfo



commit 0f353b22a629c73a61122e815c63525ee7f7ad18
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Mon Dec 6 17:52:59 2021 -0800

    file-helpers: Fix a memory leak of GFileInfo
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1042>

 lib/ephy-file-helpers.c | 6 ++++--
 1 file 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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]