From: Tom Yu Date: Thu, 16 Nov 2006 21:18:45 +0000 (+0000) Subject: pull up r18815 from trunk X-Git-Tag: krb5-1.6-beta1~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebdc8cbc2d729bfb0a9b1223a8f25086252f8b2e;p=krb5.git pull up r18815 from trunk r18815@cathode-dark-space: raeburn | 2006-11-15 20:14:14 -0500 ticket: new subject: avoid double frees in ccache manipulation around gen_new target_version: 1.6 tags: pullup * krb5/krb/vfy_increds.c (krb5_verify_init_creds): If krb5_cc_gen_new fails, don't both close and destroy the template ccache. * gssapi/krb5/accept_sec_context.c (rd_and_store_for_creds): Likewise. ticket: 4774 version_fixed: 1.6 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@18825 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/accept_sec_context.c b/src/lib/gssapi/krb5/accept_sec_context.c index ed4c3e221..618b012f9 100644 --- a/src/lib/gssapi/krb5/accept_sec_context.c +++ b/src/lib/gssapi/krb5/accept_sec_context.c @@ -141,8 +141,10 @@ rd_and_store_for_creds(context, auth_context, inbuf, out_cred) goto cleanup; ccache = template_ccache; /* krb5_cc_gen_new will replace so make a copy */ - if ((retval = krb5_cc_gen_new(context, &ccache))) + if ((retval = krb5_cc_gen_new(context, &ccache))) { + ccache = NULL; goto cleanup; + } if ((retval = krb5_cc_initialize(context, ccache, creds[0]->client))) goto cleanup; diff --git a/src/lib/krb5/krb/vfy_increds.c b/src/lib/krb5/krb/vfy_increds.c index 10a68f20d..39fb1f083 100644 --- a/src/lib/krb5/krb/vfy_increds.c +++ b/src/lib/krb5/krb/vfy_increds.c @@ -143,9 +143,10 @@ krb5_verify_init_creds(krb5_context context, if ((ret = krb5_cc_resolve(context, "MEMORY:rd_req", &template_ccache))) goto cleanup; ccache = template_ccache; /* krb5_cc_gen_new will replace so make a copy */ - - if ((ret = krb5_cc_gen_new(context, &ccache))) - goto cleanup; + if ((ret = krb5_cc_gen_new(context, &ccache))) { + ccache = NULL; + goto cleanup; + } if ((ret = krb5_cc_initialize(context, ccache, creds->client))) goto cleanup;