From: Theodore Tso Date: Thu, 2 Jun 1994 16:39:11 +0000 (+0000) Subject: Make sure the old contents of the creds structure are freed out before X-Git-Tag: krb5-1.0-beta4~183 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0e909c8a1f829c4fc6d1f8238758165348607b47;p=krb5.git Make sure the old contents of the creds structure are freed out before they are replaced. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3668 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/get_creds.c b/src/lib/krb5/krb/get_creds.c index 5126b06ce..33c05386c 100644 --- a/src/lib/krb5/krb/get_creds.c +++ b/src/lib/krb5/krb/get_creds.c @@ -56,7 +56,7 @@ krb5_creds *creds; { krb5_error_code retval, rv2; krb5_creds **tgts; - krb5_creds mcreds; + krb5_creds mcreds, ncreds; krb5_flags fields; if (!creds || !creds->server || !creds->client) @@ -82,7 +82,11 @@ krb5_creds *creds; return KRB5_NO_2ND_TKT; } - retval = krb5_cc_retrieve_cred(ccache, fields, &mcreds, creds); + retval = krb5_cc_retrieve_cred(ccache, fields, &mcreds, &ncreds); + if (retval == 0) { + krb5_free_cred_contents(creds); + *creds = ncreds; + } if (retval != KRB5_CC_NOTFOUND || options & KRB5_GC_CACHED) return retval;