Make sure the old contents of the creds structure are freed out before
authorTheodore Tso <tytso@mit.edu>
Thu, 2 Jun 1994 16:39:11 +0000 (16:39 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 2 Jun 1994 16:39:11 +0000 (16:39 +0000)
they are replaced.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3668 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/get_creds.c

index 5126b06ce675f678895963a0fad78a8b7f440c80..33c05386c42c070cbeaba9cecff6f09e8f67fdb2 100644 (file)
@@ -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;