diff options
author | Ken Raeburn <raeburn@mit.edu> | 2006-11-16 01:14:14 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2006-11-16 01:14:14 +0000 |
commit | dd4511f8b92d699a9252f120ce64fc827470de48 (patch) | |
tree | 2f0634faedbfce5603215f22ee59eb8f8ed3fc35 | |
parent | b398645d8d98166eaae2461b25ad9023fb8b5433 (diff) | |
download | krb5-dd4511f8b92d699a9252f120ce64fc827470de48.zip krb5-dd4511f8b92d699a9252f120ce64fc827470de48.tar.gz krb5-dd4511f8b92d699a9252f120ce64fc827470de48.tar.bz2 |
avoid double frees in ccache manipulation around gen_new
* 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: new
target_version: 1.6
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18815 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/gssapi/krb5/accept_sec_context.c | 4 | ||||
-rw-r--r-- | src/lib/krb5/krb/vfy_increds.c | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/gssapi/krb5/accept_sec_context.c b/src/lib/gssapi/krb5/accept_sec_context.c index ed4c3e2..618b012 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 10a68f2..39fb1f0 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; |