From 719a2475df345ed2157996de1407b1507ac11d12 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 22 Apr 2010 20:07:08 +0000 Subject: [PATCH] In kg_new_connection(), make sure k_cred is freed in all failure cases. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23926 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/init_sec_context.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/gssapi/krb5/init_sec_context.c b/src/lib/gssapi/krb5/init_sec_context.c index 82baca128..b81d5b312 100644 --- a/src/lib/gssapi/krb5/init_sec_context.c +++ b/src/lib/gssapi/krb5/init_sec_context.c @@ -483,7 +483,7 @@ kg_new_connection( { OM_uint32 major_status; krb5_error_code code; - krb5_creds *k_cred; + krb5_creds *k_cred = NULL; krb5_gss_ctx_id_rec *ctx, *ctx_free; krb5_timestamp now; gss_buffer_desc token; @@ -618,8 +618,6 @@ kg_new_connection( goto fail; } - krb5_free_creds(context, k_cred); - k_cred = NULL; ctx->enc = NULL; ctx->seq = NULL; ctx->have_acceptor_subkey = 0; @@ -672,6 +670,7 @@ kg_new_connection( } fail: + krb5_free_creds(context, k_cred); if (ctx_free) { if (ctx_free->auth_context) krb5_auth_con_free(context, ctx_free->auth_context); -- 2.26.2