autofs-5.1.6 - fix lookup_nss_read_master() nsswicth check return

From: Ian Kent <raven@themaw.net>

When reading master map nsswicth sources the result of reading the master
map should be returned rather than the result of the nsswitch check.

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

diff --git a/CHANGELOG b/CHANGELOG
index 8e024420..ebe20cd7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@ xx/xx/2020 autofs-5.1.7
 - samples/ldap.schema fix.
 - fix configure force shutdown check.
 - fix crash in sun_mount().
+- fix lookup_nss_read_master() nsswicth check return.
 
 07/10/2019 autofs-5.1.6
 - support strictexpire mount option.
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 8d54c465..c7c4e9ba 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -303,10 +303,8 @@ int lookup_nss_read_master(struct master *master, time_t age)
 			master->read_fail = 1;
 
 		status = check_nss_result(this, result);
-		if (status >= 0) {
-			free_sources(&nsslist);
-			return status;
-		}
+		if (status >= 0)
+			break;
 	}
 
 	if (!list_empty(&nsslist))
