[gvfs] afc: Fix several memory leaks



commit 9f1584ad558f3dfae7d6490f84c21155fc55e526
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jun 9 18:41:58 2016 +0200

    afc: Fix several memory leaks
    
    Memory is not released on several places, when handling errors
    mostly. Add missing g_free calls to avoid those memory leaks.

 daemon/gvfsbackendafc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 068eb56..2f264ab 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -1120,10 +1120,13 @@ not_found_bail:
                                                          new_path ? new_path : path, AFC_FOPEN_RDONLY, &fd),
                                           G_VFS_JOB(job))))
     {
+      g_free (new_path);
       g_free (app);
       return;
     }
 
+  g_free (new_path);
+
   handle = g_vfs_backend_file_handle_new (self, app);
   handle->fd = fd;
   handle->afc_cli = afc_cli;
@@ -1168,6 +1171,7 @@ g_vfs_backend_afc_create (GVfsBackend *backend,
       info = g_hash_table_lookup (self->apps, app);
       if (info == NULL)
         {
+          g_free (new_path);
           g_free (app);
           g_vfs_backend_afc_check (AFC_E_OBJECT_NOT_FOUND, G_VFS_JOB(job));
           return;
@@ -1237,6 +1241,7 @@ g_vfs_backend_afc_append_to (GVfsBackend *backend,
       info = g_hash_table_lookup (self->apps, app);
       if (info == NULL)
         {
+          g_free (new_path);
           g_free (app);
           g_vfs_backend_afc_check (AFC_E_OBJECT_NOT_FOUND, G_VFS_JOB(job));
           return;
@@ -1335,6 +1340,7 @@ g_vfs_backend_afc_replace (GVfsBackend *backend,
       info = g_hash_table_lookup (self->apps, app);
       if (info == NULL)
         {
+          g_free (new_path);
           g_free (app);
           g_vfs_backend_afc_check (AFC_E_OBJECT_NOT_FOUND, G_VFS_JOB(job));
           return;
@@ -2617,6 +2623,9 @@ g_vfs_backend_afc_move (GVfsBackend *backend,
       info = g_hash_table_lookup (self->apps, app_src);
       if (info == NULL)
         {
+          g_free (app_src);
+          g_free (new_src);
+          g_free (new_dst);
           g_vfs_backend_afc_check (AFC_E_OBJECT_NOT_FOUND, G_VFS_JOB(job));
           return;
         }


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