librpc: Free krb5 context on error
authorSwen Schillig <swen@linux.ibm.com>
Wed, 21 Nov 2018 11:53:30 +0000 (12:53 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 22 Nov 2018 07:22:18 +0000 (08:22 +0100)
If the call to krb5_cc_resolve() fails and processing is aborted,
the krb5 conext must be free'd before return.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/librpc/crypto/gse.c

index 70e29c2792396c4b0c35a3eb5fcaf5a5ab7b49dd..2c00ea9bbcb407cc8e1517f52f973a5c10265ac2 100644 (file)
@@ -236,6 +236,10 @@ static NTSTATUS gse_context_init(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 
 err_out:
+       if (gse_ctx->k5ctx) {
+               krb5_free_context(gse_ctx->k5ctx);
+       }
+
        TALLOC_FREE(gse_ctx);
        return status;
 }