[gvfs] Don't leak dbus messages



commit 7460f26f9243e6b1745a448b8dc05b15d12aa86e
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Apr 15 13:05:30 2011 +0200

    Don't leak dbus messages
    
    We're missing a lot of dbus_message_unref after sending
    messages, add them.

 daemon/daemon-main.c             |    1 +
 daemon/gvfsjobcopy.c             |    2 ++
 daemon/gvfsjobcreatemonitor.c    |    1 +
 daemon/gvfsjobdelete.c           |    1 +
 daemon/gvfsjobenumerate.c        |    1 +
 daemon/gvfsjobmakedirectory.c    |    1 +
 daemon/gvfsjobmakesymlink.c      |    1 +
 daemon/gvfsjobmountmountable.c   |    1 +
 daemon/gvfsjobmove.c             |    1 +
 daemon/gvfsjobopenforread.c      |    1 +
 daemon/gvfsjobopenforwrite.c     |    1 +
 daemon/gvfsjobopeniconforread.c  |    1 +
 daemon/gvfsjobpollmountable.c    |    1 +
 daemon/gvfsjobpull.c             |    1 +
 daemon/gvfsjobpush.c             |    1 +
 daemon/gvfsjobqueryattributes.c  |    1 +
 daemon/gvfsjobqueryfsinfo.c      |    1 +
 daemon/gvfsjobqueryinfo.c        |    1 +
 daemon/gvfsjobsetattribute.c     |    1 +
 daemon/gvfsjobsetdisplayname.c   |    1 +
 daemon/gvfsjobstartmountable.c   |    1 +
 daemon/gvfsjobstopmountable.c    |    1 +
 daemon/gvfsjobtrash.c            |    1 +
 daemon/gvfsjobunmount.c          |    1 +
 daemon/gvfsjobunmountmountable.c |    1 +
 daemon/gvfsmonitor.c             |   12 ++++++++----
 daemon/mount.c                   |   28 +++++++++++++++++++++-------
 27 files changed, 55 insertions(+), 11 deletions(-)
---
diff --git a/daemon/daemon-main.c b/daemon/daemon-main.c
index 22cebe6..13e4780 100644
--- a/daemon/daemon-main.c
+++ b/daemon/daemon-main.c
@@ -127,6 +127,7 @@ send_spawned (DBusConnection *connection, gboolean succeeded, char *error_messag
     _g_dbus_oom ();
     
   dbus_connection_send (connection, message, NULL);
+  dbus_message_unref (message);
   /* Make sure the message is sent */
   dbus_connection_flush (connection);
 }
diff --git a/daemon/gvfsjobcopy.c b/daemon/gvfsjobcopy.c
index 730e1e2..e833168 100644
--- a/daemon/gvfsjobcopy.c
+++ b/daemon/gvfsjobcopy.c
@@ -104,6 +104,8 @@ g_vfs_job_copy_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
+
       return NULL;
     }
 
diff --git a/daemon/gvfsjobcreatemonitor.c b/daemon/gvfsjobcreatemonitor.c
index 074a866..e825de3 100644
--- a/daemon/gvfsjobcreatemonitor.c
+++ b/daemon/gvfsjobcreatemonitor.c
@@ -104,6 +104,7 @@ g_vfs_job_create_monitor_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobdelete.c b/daemon/gvfsjobdelete.c
index 688e604..bbc3891 100644
--- a/daemon/gvfsjobdelete.c
+++ b/daemon/gvfsjobdelete.c
@@ -96,6 +96,7 @@ g_vfs_job_delete_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobenumerate.c b/daemon/gvfsjobenumerate.c
index 90ff452..208f0ba 100644
--- a/daemon/gvfsjobenumerate.c
+++ b/daemon/gvfsjobenumerate.c
@@ -110,6 +110,7 @@ g_vfs_job_enumerate_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobmakedirectory.c b/daemon/gvfsjobmakedirectory.c
index 2e9c7e2..61257d9 100644
--- a/daemon/gvfsjobmakedirectory.c
+++ b/daemon/gvfsjobmakedirectory.c
@@ -96,6 +96,7 @@ g_vfs_job_make_directory_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobmakesymlink.c b/daemon/gvfsjobmakesymlink.c
index 157e70f..0ea22fa 100644
--- a/daemon/gvfsjobmakesymlink.c
+++ b/daemon/gvfsjobmakesymlink.c
@@ -99,6 +99,7 @@ g_vfs_job_make_symlink_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobmountmountable.c b/daemon/gvfsjobmountmountable.c
index 1d60836..6cc2ea2 100644
--- a/daemon/gvfsjobmountmountable.c
+++ b/daemon/gvfsjobmountmountable.c
@@ -109,6 +109,7 @@ g_vfs_job_mount_mountable_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobmove.c b/daemon/gvfsjobmove.c
index 0f3b7a2..9a6bd89 100644
--- a/daemon/gvfsjobmove.c
+++ b/daemon/gvfsjobmove.c
@@ -104,6 +104,7 @@ g_vfs_job_move_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobopenforread.c b/daemon/gvfsjobopenforread.c
index 31265db..d217c27 100644
--- a/daemon/gvfsjobopenforread.c
+++ b/daemon/gvfsjobopenforread.c
@@ -106,6 +106,7 @@ g_vfs_job_open_for_read_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobopenforwrite.c b/daemon/gvfsjobopenforwrite.c
index 6d368f8..6e7396c 100644
--- a/daemon/gvfsjobopenforwrite.c
+++ b/daemon/gvfsjobopenforwrite.c
@@ -116,6 +116,7 @@ g_vfs_job_open_for_write_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       g_free (path);
       return NULL;
     }
diff --git a/daemon/gvfsjobopeniconforread.c b/daemon/gvfsjobopeniconforread.c
index 1e36a24..59e813a 100644
--- a/daemon/gvfsjobopeniconforread.c
+++ b/daemon/gvfsjobopeniconforread.c
@@ -87,6 +87,7 @@ g_vfs_job_open_icon_for_read_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobpollmountable.c b/daemon/gvfsjobpollmountable.c
index 4fa67b1..ac59da2 100644
--- a/daemon/gvfsjobpollmountable.c
+++ b/daemon/gvfsjobpollmountable.c
@@ -99,6 +99,7 @@ g_vfs_job_poll_mountable_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobpull.c b/daemon/gvfsjobpull.c
index 4d66bf0..1d4bc78 100644
--- a/daemon/gvfsjobpull.c
+++ b/daemon/gvfsjobpull.c
@@ -107,6 +107,7 @@ g_vfs_job_pull_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobpush.c b/daemon/gvfsjobpush.c
index 49680b3..b4b3874 100644
--- a/daemon/gvfsjobpush.c
+++ b/daemon/gvfsjobpush.c
@@ -107,6 +107,7 @@ g_vfs_job_push_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobqueryattributes.c b/daemon/gvfsjobqueryattributes.c
index 426a26b..3307cfa 100644
--- a/daemon/gvfsjobqueryattributes.c
+++ b/daemon/gvfsjobqueryattributes.c
@@ -100,6 +100,7 @@ g_vfs_job_query_attributes_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobqueryfsinfo.c b/daemon/gvfsjobqueryfsinfo.c
index cce7ded..e464590 100644
--- a/daemon/gvfsjobqueryfsinfo.c
+++ b/daemon/gvfsjobqueryfsinfo.c
@@ -101,6 +101,7 @@ g_vfs_job_query_fs_info_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobqueryinfo.c b/daemon/gvfsjobqueryinfo.c
index 3a52539..27c8edc 100644
--- a/daemon/gvfsjobqueryinfo.c
+++ b/daemon/gvfsjobqueryinfo.c
@@ -110,6 +110,7 @@ g_vfs_job_query_info_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobsetattribute.c b/daemon/gvfsjobsetattribute.c
index c908216..ad2a8a2 100644
--- a/daemon/gvfsjobsetattribute.c
+++ b/daemon/gvfsjobsetattribute.c
@@ -120,6 +120,7 @@ g_vfs_job_set_attribute_new (DBusConnection *connection,
                                       _("Invalid dbus message"));
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobsetdisplayname.c b/daemon/gvfsjobsetdisplayname.c
index 9ac10a3..0816c8b 100644
--- a/daemon/gvfsjobsetdisplayname.c
+++ b/daemon/gvfsjobsetdisplayname.c
@@ -100,6 +100,7 @@ g_vfs_job_set_display_name_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobstartmountable.c b/daemon/gvfsjobstartmountable.c
index e862846..b4492db 100644
--- a/daemon/gvfsjobstartmountable.c
+++ b/daemon/gvfsjobstartmountable.c
@@ -105,6 +105,7 @@ g_vfs_job_start_mountable_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobstopmountable.c b/daemon/gvfsjobstopmountable.c
index 31f480a..c291d38 100644
--- a/daemon/gvfsjobstopmountable.c
+++ b/daemon/gvfsjobstopmountable.c
@@ -107,6 +107,7 @@ g_vfs_job_stop_mountable_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobtrash.c b/daemon/gvfsjobtrash.c
index e6f6388..338bf0d 100644
--- a/daemon/gvfsjobtrash.c
+++ b/daemon/gvfsjobtrash.c
@@ -96,6 +96,7 @@ g_vfs_job_trash_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobunmount.c b/daemon/gvfsjobunmount.c
index ee2cb7e..17e364f 100644
--- a/daemon/gvfsjobunmount.c
+++ b/daemon/gvfsjobunmount.c
@@ -106,6 +106,7 @@ g_vfs_job_unmount_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsjobunmountmountable.c b/daemon/gvfsjobunmountmountable.c
index ed648ca..9cf9c2d 100644
--- a/daemon/gvfsjobunmountmountable.c
+++ b/daemon/gvfsjobunmountmountable.c
@@ -108,6 +108,7 @@ g_vfs_job_unmount_mountable_new (DBusConnection *connection,
       dbus_error_free (&derror);
 
       dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
       return NULL;
     }
 
diff --git a/daemon/gvfsmonitor.c b/daemon/gvfsmonitor.c
index 4b91ece..8947099 100644
--- a/daemon/gvfsmonitor.c
+++ b/daemon/gvfsmonitor.c
@@ -184,8 +184,9 @@ vfs_monitor_message_callback (DBusConnection  *connection,
 					  derror.name,
 					  derror.message);
 	  dbus_error_free (&derror);
-	  
+
 	  dbus_connection_send (connection, reply, NULL);
+	  dbus_message_unref (reply);
 	}
       else
 	{
@@ -199,8 +200,9 @@ vfs_monitor_message_callback (DBusConnection  *connection,
 
 	  reply = dbus_message_new_method_return (message);
 	  dbus_connection_send (connection, reply, NULL);
+	  dbus_message_unref (reply);
 	}
-      
+
       return DBUS_HANDLER_RESULT_HANDLED;
     }
   else if (dbus_message_is_method_call (message,
@@ -216,8 +218,9 @@ vfs_monitor_message_callback (DBusConnection  *connection,
 					  derror.name,
 					  derror.message);
 	  dbus_error_free (&derror);
-	  
+
 	  dbus_connection_send (connection, reply, NULL);
+	  dbus_message_unref (reply);
 	}
       else
 	{
@@ -235,9 +238,10 @@ vfs_monitor_message_callback (DBusConnection  *connection,
 		  break;
 		}
 	    }
-	  
+
 	  reply = dbus_message_new_method_return (message);
 	  dbus_connection_send (connection, reply, NULL);
+	  dbus_message_unref (reply);
 
 	  g_object_unref (monitor);
 	}
diff --git a/daemon/mount.c b/daemon/mount.c
index 2331559..6eb07d3 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -757,6 +757,7 @@ register_mount (DBusConnection *connection,
     _g_dbus_oom ();
   
   dbus_connection_send (connection, reply, NULL);
+  dbus_message_unref (reply);
 }
 
 typedef struct {
@@ -778,6 +779,7 @@ automount_done (VfsMountable *mountable,
 					G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
 					_("Automount failed: %s"), error->message);
       dbus_connection_send (data->connection, reply, NULL);
+      dbus_message_unref (reply);
     }
   else
     lookup_mount (data->connection,
@@ -870,7 +872,10 @@ lookup_mount (DBusConnection *connection,
   
   g_mount_spec_unref (spec);
   if (reply != NULL)
-    dbus_connection_send (connection, reply, NULL);
+    {
+      dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
+    }
 }
 
 static void
@@ -910,9 +915,12 @@ lookup_mount_by_fuse_path (DBusConnection *connection,
     reply = dbus_message_new_error (message,
 				    DBUS_ERROR_INVALID_ARGS,
 				    "Invalid arguments");
-  
+
   if (reply != NULL)
-    dbus_connection_send (connection, reply, NULL);
+    {
+      dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
+    }
 }
 
 static void
@@ -958,8 +966,9 @@ list_mounts (DBusConnection *connection,
 
   if (!dbus_message_iter_close_container (&iter, &array_iter))
     _g_dbus_oom ();
-  
+
   dbus_connection_send (connection, reply, NULL);
+  dbus_message_unref (reply);
 }
 
 static void
@@ -1047,7 +1056,10 @@ mount_location (DBusConnection *connection,
     }
   
   if (reply)
-    dbus_connection_send (connection, reply, NULL);
+    {
+      dbus_connection_send (connection, reply, NULL);
+      dbus_message_unref (reply);
+    }
   else
     {
       GMountSource *source;
@@ -1099,8 +1111,9 @@ list_mount_types (DBusConnection *connection,
 
   if (!dbus_message_iter_close_container (&iter, &array_iter))
     _g_dbus_oom ();
-  
+
   dbus_connection_send (connection, reply, NULL);
+  dbus_message_unref (reply);
 }
 
 static void
@@ -1140,8 +1153,9 @@ list_mountable_info (DBusConnection *connection,
 
   if (!dbus_message_iter_close_container (&iter, &array_iter))
     _g_dbus_oom ();
-  
+
   dbus_connection_send (connection, reply, NULL);
+  dbus_message_unref (reply);
 }
 
 static DBusHandlerResult



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