krb5_context ctx;
struct ip_service *kdcs;
const char *realm;
+ char **get_host_realms = NULL;
int num_kdcs = 0;
int i;
NTSTATUS status;
} 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;
}
d_printf("%s:%u\n", addr, kdcs[i].port);
}
+ krb5_free_host_realm(ctx, get_host_realms);
krb5_free_context(ctx);
return 0;
#endif