Handle case when zone_scandir() returns NULL
authorDagobert Michelsen <dam@opencsw.org>
Thu, 28 May 2015 11:19:02 +0000 (13:19 +0200)
committerDagobert Michelsen <dam@opencsw.org>
Thu, 28 May 2015 11:19:02 +0000 (13:19 +0200)
src/zone.c

index 52dd977..e4aad81 100644 (file)
@@ -188,6 +188,9 @@ static int zone_read (void)
 
        tree=zone_scandir(procdir);
        closedir(procdir);
 
        tree=zone_scandir(procdir);
        closedir(procdir);
+       if (tree == NULL) {
+               return (-1);
+       }
        zone_submit_values(tree); /* this also frees tree */
        return (0);
 }
        zone_submit_values(tree); /* this also frees tree */
        return (0);
 }