[gvfs] Don't crash if mount_operation is given as NULL



commit a9c38f1b15e56f2d08d5ffccd0483aee68095c00
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Mon Oct 28 11:59:30 2013 +0200

    Don't crash if mount_operation is given as NULL
    
    Check for NULL before using the mount_operation given to any of
    GDaemonFile's methods to prevent a crash due to refing NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710995

 client/gdaemonfile.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 48c7c82..58c9cf9 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -1482,7 +1482,8 @@ g_daemon_file_mount_mountable (GFile               *file,
  
   data = g_new0 (AsyncMountOp, 1);
   data->flags = flags;
-  data->mount_operation = g_object_ref (mount_operation);
+  if (mount_operation)
+    data->mount_operation = g_object_ref (mount_operation);
   if (cancellable)
     data->cancellable = g_object_ref (cancellable);
 
@@ -1573,7 +1574,8 @@ g_daemon_file_start_mountable (GFile               *file,
   
   data = g_new0 (AsyncMountOp, 1);
   data->flags = flags;
-  data->mount_operation = g_object_ref (mount_operation);
+  if (mount_operation)
+    data->mount_operation = g_object_ref (mount_operation);
   if (cancellable)
     data->cancellable = g_object_ref (cancellable);
 
@@ -1658,7 +1660,8 @@ g_daemon_file_stop_mountable (GFile               *file,
   
   data = g_new0 (AsyncMountOp, 1);
   data->flags = flags;
-  data->mount_operation = g_object_ref (mount_operation);
+  if (mount_operation)
+    data->mount_operation = g_object_ref (mount_operation);
   if (cancellable)
     data->cancellable = g_object_ref (cancellable);
 
@@ -1743,7 +1746,8 @@ g_daemon_file_eject_mountable_with_operation (GFile               *file,
   
   data = g_new0 (AsyncMountOp, 1);
   data->flags = flags;
-  data->mount_operation = g_object_ref (mount_operation);
+  if (mount_operation)
+    data->mount_operation = g_object_ref (mount_operation);
   if (cancellable)
     data->cancellable = g_object_ref (cancellable);
 
@@ -1846,7 +1850,8 @@ g_daemon_file_unmount_mountable_with_operation (GFile               *file,
   
   data = g_new0 (AsyncMountOp, 1);
   data->flags = flags;
-  data->mount_operation = g_object_ref (mount_operation);
+  if (mount_operation)
+    data->mount_operation = g_object_ref (mount_operation);
   if (cancellable)
     data->cancellable = g_object_ref (cancellable);
 


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