autofs-5.1.9 - fix incorrect error handling in sasl_do_kinit_ext_cc()

From: Ian Kent <raven@themaw.net>

In sasl_do_kinit_ext_cc() if resolving ctxt->krb5_ccache fails it is
incorrectly closed.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG            |    1 +
 modules/cyrus-sasl.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 2e223989c..1885dcbec 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -44,6 +44,7 @@
 - fix string length check in merge_options()
 - dont initialize hosts list in add_host().
 - initialise process variables in log_pidinfo().
+- fix incorrect error handling in sasl_do_kinit_ext_cc().
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
index 69e613bad..fa16be393 100644
--- a/modules/cyrus-sasl.c
+++ b/modules/cyrus-sasl.c
@@ -811,7 +811,7 @@ sasl_do_kinit_ext_cc(unsigned logopt, struct lookup_context *ctxt)
 	if (ret) {
 		error(logopt, "krb5_cc_resolve failed with error %d",
 		      ret);
-		goto out_cleanup_cc;
+		goto out_cleanup_context;
 	}
 
 	ret = krb5_cc_get_principal(ctxt->krb5ctxt, ctxt->krb5_ccache, &def_princ);
@@ -913,6 +913,7 @@ out_cleanup_def_princ:
 	krb5_free_principal(ctxt->krb5ctxt, def_princ);
 out_cleanup_cc:
 	krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
+out_cleanup_context:
 	krb5_free_context(ctxt->krb5ctxt);
 out_unlock:
 	status = pthread_mutex_unlock(&krb5cc_mutex);
