From b81f16abf648e458722a9d5de0e1da551da74f45 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Thu, 19 Mar 2015 22:10:51 -0500 Subject: [PATCH] Fix memleak in kswitch rare error --- kuser/kswitch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kuser/kswitch.c b/kuser/kswitch.c index 98170f489..c7fe312ff 100644 --- a/kuser/kswitch.c +++ b/kuser/kswitch.c @@ -90,8 +90,10 @@ kswitch(struct kswitch_options *opt, int argc, char **argv) char num[10]; ret = krb5_cc_get_principal(heimtools_context, id, &p); - if (ret) + if (ret) { + krb5_cc_close(heimtools_context, id); continue; + } ret = krb5_unparse_name(heimtools_context, p, &name); krb5_free_principal(heimtools_context, p);