[gvfs] Fix some potential NULL dereferences



commit 3c1b401670c7fbdf7ad8f3034b3d508ae719d6d3
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Dec 7 16:34:56 2012 +0100

    Fix some potential NULL dereferences

 daemon/gvfsbackendgphoto2.c   |    2 +-
 daemon/gvfsbackendlocaltest.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 4fe76f7..0bf346a 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -1497,7 +1497,7 @@ ensure_ignore_prefix (GVfsBackendGphoto2 *gphoto2_backend, GVfsJob *job)
     }
 
   /* Some cameras, such as the Canon 5D, won't report the basedir */
-  if (head->fields & GP_STORAGEINFO_BASE)
+  if (head && head->fields & GP_STORAGEINFO_BASE)
     prefix = g_strdup_printf ("%s/", head->basedir);
 
  out:
diff --git a/daemon/gvfsbackendlocaltest.c b/daemon/gvfsbackendlocaltest.c
index d1fcc92..62b5193 100644
--- a/daemon/gvfsbackendlocaltest.c
+++ b/daemon/gvfsbackendlocaltest.c
@@ -154,7 +154,7 @@ get_g_file_info_from_local (const char *filename, GFile *file,
 		error = NULL;
 		info = g_file_query_info (file, attributes, flags, G_VFS_JOB (job)->cancellable, &error);
 		
-		if ((error) || (! info) ) {
+		if (info == NULL) {
 		    g_print (" (EE) get_g_file_info_from_local (filename = '%s'): g_file_query_info failed: %s \n", filename, error->message);
 		    g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
 		    return NULL;
@@ -392,7 +392,7 @@ do_query_fs_info (GVfsBackend *backend,
   if (file) {
 	  error = NULL;  
 	  info2 = g_file_query_filesystem_info (file, "fs:*", G_VFS_JOB (job)->cancellable, &error);
-	  if ((error) || (! info2) ) {
+	  if (info2 == NULL) {
 		  g_print ("  (EE) try_query_fs_info (filename = '%s'): g_file_query_filesystem_info failed: %s \n", filename, error->message);
 		  g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
 		  g_error_free (error);



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