[gvfs] metadata: Avoid passing NULL to strchr()



commit 7deeda8806e58a1b4c2f9b063ab1b68913cafc30
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Mon Aug 15 15:14:16 2011 +0200

    metadata: Avoid passing NULL to strchr()
    
    Found by Coverity Scan analysis

 metadata/metatree.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/metadata/metatree.c b/metadata/metatree.c
index e9797b7..d274882 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -2954,7 +2954,8 @@ parse_mountinfo (const char *contents)
 	  g_array_append_val (a, new_entry);
 	}
 
-      line = strchr (line, '\n');
+      if (line)
+	line = strchr (line, '\n');
       if (line)
 	line++;
     }



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