From f6bbd591d636e4309ec37659f825b0f9c53d4b6b Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikhono@redhat.com>
Date: Mon, 19 Jun 2023 20:56:14 +0200
Subject: [PATCH] KRB5: avoid another attempt to free 'cc' in 'done:' section
 if first attempt failed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>

Reference: https://github.com/SSSD/sssd/commit/f6bbd591d636e4309ec37659f825b0f9c53d4b6b
Conflict: NA
---
 src/providers/krb5/krb5_ccache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/krb5/krb5_ccache.c b/src/providers/krb5/krb5_ccache.c
index 5b80fec52..72c3a23de 100644
--- a/src/providers/krb5/krb5_ccache.c
+++ b/src/providers/krb5/krb5_ccache.c
@@ -637,12 +637,12 @@ errno_t get_ccache_file_data(const char *ccache_file, const char *client_name,
     krb5_free_cred_contents(ctx, &cred);
 
     kerr = krb5_cc_close(ctx, cc);
+    cc = NULL;
     if (kerr != 0) {
         KRB5_DEBUG(SSSDBG_OP_FAILURE, ctx, kerr);
         DEBUG(SSSDBG_CRIT_FAILURE, "krb5_cc_close failed.\n");
         goto done;
     }
-    cc = NULL;
 
     kerr = 0;
 
-- 
2.27.0

