summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSwen Schillig <swen@linux.ibm.com>2018-11-21 13:30:08 +0100
committerRalph Boehme <slow@samba.org>2018-11-22 11:18:41 +0100
commit64fbc4c151158a1bc8864b3db56c79c4367cd7f2 (patch)
tree2dc06ccbc6e26029cd065d8e6dc93149ec752b62 /source3
parentc73c345f6f47cc124109925f87536fdf0febc702 (diff)
downloadsamba-64fbc4c151158a1bc8864b3db56c79c4367cd7f2.tar.gz
utils: Free host realm after processing
In case of error and at the end of processing the list of realms have to be free'd again. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Nov 22 11:18:41 CET 2018 on sn-devel-144
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_lookup.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index f94af266daa..140f9900795 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -281,6 +281,7 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv)
krb5_context ctx;
struct ip_service *kdcs;
const char *realm;
+ char **get_host_realms = NULL;
int num_kdcs = 0;
int i;
NTSTATUS status;
@@ -298,21 +299,20 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv)
} else if (lp_realm() && *lp_realm()) {
realm = lp_realm();
} else {
- char **realms;
-
- rc = krb5_get_host_realm(ctx, NULL, &realms);
+ rc = krb5_get_host_realm(ctx, NULL, &get_host_realms);
if (rc) {
DEBUG(1,("krb5_gethost_realm failed (%s)\n",
error_message(rc)));
krb5_free_context(ctx);
return -1;
}
- realm = (const char *) *realms;
+ realm = (const char *) *get_host_realms;
}
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_host_realm(ctx, get_host_realms);
krb5_free_context(ctx);
return -1;
}
@@ -325,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_host_realm(ctx, get_host_realms);
krb5_free_context(ctx);
return 0;
#endif