[glib] gfileutils: Add precondition checks to g_file_test()



commit a5b58da6bf3bb21cbd3d030a369aad330f90f891
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Sep 15 10:00:44 2015 +0100

    gfileutils: Add precondition checks to g_file_test()
    
    Otherwise g_file_test(NULL, …) causes a call to access(NULL, …) on
    Linux, which is disallowed and valgrind complains about it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755046

 glib/gfileutils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index 40775e2..dbf9691 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -317,6 +317,8 @@ gboolean
 g_file_test (const gchar *filename,
              GFileTest    test)
 {
+  g_return_val_if_fail (filename != NULL, FALSE);
+
 #ifdef G_OS_WIN32
 /* stuff missing in std vc6 api */
 #  ifndef INVALID_FILE_ATTRIBUTES


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