From: Swen Schillig Date: Wed, 21 Nov 2018 12:17:38 +0000 (+0100) Subject: utils: Free krb5 context for net_lookup_kdc X-Git-Tag: tdb-1.3.17~676 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c73c345f6f47cc124109925f87536fdf0febc702;p=thirdparty%2Fsamba.git 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 --- 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"));