Avoid reading uninitialized memory
authorAlexander Larsson <alexl@redhat.com>
Mon, 7 Sep 2009 10:50:58 +0000 (12:50 +0200)
committerAlexander Larsson <alexl@redhat.com>
Mon, 7 Sep 2009 10:50:58 +0000 (12:50 +0200)
If the statfs call fails, don't look at the result.

gio/glocalfile.c

index 8ed1e09..bb14315 100644 (file)
@@ -955,7 +955,8 @@ g_local_file_query_filesystem_info (GFile         *file,
      free == 0 case as "both of these are invalid".
    */
 #ifndef G_OS_WIN32
-  if (statfs_buffer.f_bavail == 0 && statfs_buffer.f_bfree == 0)
+  if (statfs_result == 0 &&
+      statfs_buffer.f_bavail == 0 && statfs_buffer.f_bfree == 0)
     no_size = TRUE;
 #endif