From c7feeab7eb7925e9890355cd24ab1e2e170a2510 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Tue, 11 Jan 2022 11:32:29 -0600 Subject: [PATCH] kswitch: Fix warning --- kuser/kswitch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kuser/kswitch.c b/kuser/kswitch.c index d897a8e74..3bb3b700d 100644 --- a/kuser/kswitch.c +++ b/kuser/kswitch.c @@ -86,16 +86,17 @@ kswitch(struct kswitch_options *opt, int argc, char **argv) krb5_err(heimtools_context, 1, ret, "krb5_cc_cache_get_first"); while (krb5_cc_cache_next(heimtools_context, cursor, &id) == 0) { - krb5_principal p; + krb5_principal p = NULL; char num[10]; ret = krb5_cc_get_principal(heimtools_context, id, &p); + if (ret == 0) + ret = krb5_unparse_name(heimtools_context, p, &name); if (ret) { krb5_cc_close(heimtools_context, id); continue; } - ret = krb5_unparse_name(heimtools_context, p, &name); krb5_free_principal(heimtools_context, p); snprintf(num, sizeof(num), "%d", (int)(len + 1));