auth/credentials: Add NULL check in free_mccache()
authorAndreas Schneider <asn@samba.org>
Sat, 1 Oct 2016 09:25:44 +0000 (11:25 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 20 Dec 2016 12:52:09 +0000 (13:52 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
auth/credentials/credentials_krb5.c

index 493cfa6..7b1470a 100644 (file)
@@ -42,7 +42,11 @@ static void cli_credentials_invalidate_client_gss_creds(
 /* Free a memory ccache */
 static int free_mccache(struct ccache_container *ccc)
 {
-       krb5_cc_destroy(ccc->smb_krb5_context->krb5_context, ccc->ccache);
+       if (ccc->ccache != NULL) {
+               krb5_cc_destroy(ccc->smb_krb5_context->krb5_context,
+                               ccc->ccache);
+               ccc->ccache = NULL;
+       }
 
        return 0;
 }