auth/credentials: Add NULL check to free_dccache()
authorAndreas Schneider <asn@samba.org>
Sat, 1 Oct 2016 09:27:54 +0000 (11:27 +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 7b1470a96a9f295573307909d7f689fbe4958aae..ca62e30ef73779163ef02d5b4b279ebcfa17f3e4 100644 (file)
@@ -52,8 +52,13 @@ static int free_mccache(struct ccache_container *ccc)
 }
 
 /* Free a disk-based ccache */
-static int free_dccache(struct ccache_container *ccc) {
-       krb5_cc_close(ccc->smb_krb5_context->krb5_context, ccc->ccache);
+static int free_dccache(struct ccache_container *ccc)
+{
+       if (ccc->ccache != NULL) {
+               krb5_cc_close(ccc->smb_krb5_context->krb5_context,
+                             ccc->ccache);
+               ccc->ccache = NULL;
+       }
 
        return 0;
 }