[epiphany] Fix leaks in ephy_file_get_downloads_dir



commit e2cdfcfbb12b5054d2a90dd6fddf8e4027ace387
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon Jun 25 14:06:08 2018 -0500

    Fix leaks in ephy_file_get_downloads_dir
    
    As usual, there are multiple ways to fix this, but here is what I think
    looks best....

 lib/ephy-file-helpers.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 094c40d6e..c673942cb 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -142,12 +142,17 @@ ephy_file_get_downloads_dir (void)
   download_dir = g_settings_get_string (EPHY_SETTINGS_STATE,
                                         EPHY_PREFS_STATE_DOWNLOAD_DIR);
 
-  if (!g_strcmp0 (download_dir, "Downloads") ||
+  if (g_strcmp0 (download_dir, "Downloads") == 0 ||
       !g_path_is_absolute (download_dir) ||
-      ephy_is_running_inside_flatpak ())
-    download_dir = ephy_file_download_dir ();
-  else if (!g_strcmp0 (download_dir, "Desktop"))
-    download_dir = ephy_file_desktop_dir ();
+      ephy_is_running_inside_flatpak ()) {
+    g_free (download_dir);
+    return ephy_file_download_dir ();
+  }
+
+  if (g_strcmp0 (download_dir, "Desktop") == 0) {
+    g_free (download_dir);
+    return ephy_file_desktop_dir ();
+  }
 
   return download_dir;
 }


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