[gvfs] [FTP] plug memleak in login code



commit 3d781138af38b84841c1a59a5c959ac3a412686c
Author: Benjamin Otte <otte gnome org>
Date:   Tue Aug 11 03:31:26 2009 +0200

    [FTP] plug memleak in login code

 daemon/gvfsbackendftp.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 9bba8e3..20318a6 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -371,24 +371,24 @@ try_login:
       g_free (ftp->password);
       if (anonymous)
         {
-              ftp->user = g_strdup ("anonymous");
-              ftp->password = g_strdup ("");
+          g_free (username);
+          g_free (password);
+          ftp->user = g_strdup ("anonymous");
+          ftp->password = g_strdup ("");
           if (g_vfs_ftp_task_login (&task, "anonymous", "") != 0)
-            {
-              break;
-            }
+            break;
+          g_free (ftp->user);
+          g_free (ftp->password);
           ftp->user = NULL;
           ftp->password = NULL;
         }
       else
         {
-          ftp->user = username ? g_strdup (username) : g_strdup ("");
-          ftp->password = g_strdup (password);
+          ftp->user = username ? username : g_strdup ("");
+          ftp->password = password;
           if (g_vfs_ftp_task_login (&task, ftp->user, ftp->password) != 0)
             break;
         }
-      g_free (username);
-      g_free (password);
      
       if (break_on_fail ||
           !g_error_matches (task.error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))



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