Blob Blame History Raw
autofs-5.1.7 - cater for empty mounts list in mnts_get_expire_list()

From: Ian Kent <raven@themaw.net>

Coverity: var_deref_model: Passing null pointer "tree" to
	  "tree_traverse_inorder", which dereferences it.

This obviously can't happen but deal with it anyway to quiet Coverity.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG    |    1 +
 lib/mounts.c |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -64,6 +64,7 @@
 - fix missing lock release in mount_subtree().
 - fix double free in parse_mapent().
 - refactor lookup_prune_one_cache() a bit.
+- cater for empty mounts list in mnts_get_expire_list().
 
 xx/xx/2018 autofs-5.1.5
 - fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1445,8 +1445,10 @@ void mnts_get_expire_list(struct list_he
 		}
 	}
 
-	tree_traverse_inorder(tree, tree_mnt_expire_list_work, mnts);
-	tree_free(tree);
+	if (tree) {
+		tree_traverse_inorder(tree, tree_mnt_expire_list_work, mnts);
+		tree_free(tree);
+	}
 done:
 	mnts_hash_mutex_unlock();
 }