From 0ec6d0d36355bdbea8df52c711674b9627c869c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 19 May 2005 07:42:06 +0000 Subject: [PATCH] (process_pa_data_to_md): add comment that the caller always free out_md; remove comment about memory, it doesn't happen. (init_cred_loop): free ctx->as_req.padata when its reset (From Wynn Wilkes ), move a comment close the the code git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15178 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/init_creds_pw.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/krb5/init_creds_pw.c b/lib/krb5/init_creds_pw.c index 92e7025da..6c6a21769 100644 --- a/lib/krb5/init_creds_pw.c +++ b/lib/krb5/init_creds_pw.c @@ -1057,6 +1057,10 @@ pa_data_add_pac_request(krb5_context context, return 0; } +/* + * Assumes caller always will free `out_md', even on error. + */ + static krb5_error_code process_pa_data_to_md(krb5_context context, const krb5_creds *creds, @@ -1093,7 +1097,7 @@ process_pa_data_to_md(krb5_context context, pa_data_add_pac_request(context, ctx, *out_md); ret = pa_data_to_md_pkinit(context, a, creds->client, ctx, *out_md); if (ret) - return ret; /* XXX memory leak */ + return ret; if ((*out_md)->len == 0) { free(*out_md); @@ -1201,17 +1205,16 @@ init_cred_loop(krb5_context context, if (ret) return ret; - /* - * Increase counter when we want other pre-auth types then - * KRB5_PA_ENC_TIMESTAMP. - */ - /* Set a new nonce. */ krb5_generate_random_block (&ctx->nonce, sizeof(ctx->nonce)); ctx->nonce &= 0xffffffff; /* XXX these just needs to be the same when using Windows PK-INIT */ ctx->pk_nonce = ctx->nonce; + /* + * Increase counter when we want other pre-auth types then + * KRB5_PA_ENC_TIMESTAMP. + */ #define MAX_PA_COUNTER 3 ctx->pa_counter = 0; @@ -1222,6 +1225,7 @@ init_cred_loop(krb5_context context, if (ctx->as_req.padata) { free_METHOD_DATA(ctx->as_req.padata); + free(ctx->as_req.padata); ctx->as_req.padata = NULL; }