From c73c345f6f47cc124109925f87536fdf0febc702 Mon Sep 17 00:00:00 2001 From: Swen Schillig Date: Wed, 21 Nov 2018 13:17:38 +0100 Subject: [PATCH] utils: Free krb5 context for net_lookup_kdc In case of an error while processing and at the end of processing the krb5 conext must be free'd. Signed-off-by: Swen Schillig Reviewed-by: Andreas Schneider Reviewed-by: Ralph Boehme --- source3/utils/net_lookup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 05a3dbc6e2b..f94af266daa 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -304,6 +304,7 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) if (rc) { DEBUG(1,("krb5_gethost_realm failed (%s)\n", error_message(rc))); + krb5_free_context(ctx); return -1; } realm = (const char *) *realms; @@ -312,6 +313,7 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) status = get_kdc_list(realm, NULL, &kdcs, &num_kdcs); if (!NT_STATUS_IS_OK(status)) { DEBUG(1,("get_kdc_list failed (%s)\n", nt_errstr(status))); + krb5_free_context(ctx); return -1; } @@ -323,6 +325,7 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) d_printf("%s:%u\n", addr, kdcs[i].port); } + krb5_free_context(ctx); return 0; #endif DEBUG(1, ("No kerberos support\n")); -- 2.47.2