[PATCH] librpc: Free krb5 context on error

swen swen at linux.ibm.com
Wed Nov 21 12:00:37 UTC 2018


Please review and push if happy.

... as you can see by the subject line I'm learning,
just hoping I picked the right one :-)

Thanks for your support in advance.

Cheers Swen
-------------- next part --------------
From 96ad9d4503c5685794e327ff6069d22d21f228ff Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at linux.ibm.com>
Date: Wed, 21 Nov 2018 12:53:30 +0100
Subject: [PATCH] librpc: Free krb5 context on error

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 at linux.ibm.com>
---
 source3/librpc/crypto/gse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source3/librpc/crypto/gse.c b/source3/librpc/crypto/gse.c
index d5514194b29..a66c3029481 100644
--- a/source3/librpc/crypto/gse.c
+++ b/source3/librpc/crypto/gse.c
@@ -238,6 +238,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;
 }
-- 
2.17.2



More information about the samba-technical mailing list