In copying a credential - if we run out memory - the cleanup code failed to clear...
authorEzra Peisach <epeisach@mit.edu>
Sat, 16 Aug 2008 13:01:40 +0000 (13:01 +0000)
committerEzra Peisach <epeisach@mit.edu>
Sat, 16 Aug 2008 13:01:40 +0000 (13:01 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20666 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/copy_creds.c

index 417a9a449afb3a4efbd6b93ae85c97ed28ba2524..f011a03ceceb600ae60e0fb9072339584d04fa4e 100644 (file)
@@ -84,20 +84,22 @@ krb5int_copy_creds_contents(krb5_context context, const krb5_creds *incred,
     krb5_xfree(scratch);
     retval = krb5_copy_data(context, &incred->second_ticket, &scratch);
     if (retval)
-       goto cleanticket;
+       goto clearticket;
 
     tempcred->second_ticket = *scratch;
     krb5_xfree(scratch);
 
     retval = krb5_copy_authdata(context, incred->authdata,&tempcred->authdata);
     if (retval)
-        goto clearticket;
+        goto clearsecondticket;
 
     return 0;
 
+ clearsecondticket:    
+    memset(tempcred->second_ticket.data,0,tempcred->second_ticket.length);
+    free(tempcred->second_ticket.data);
  clearticket:    
     memset(tempcred->ticket.data,0,tempcred->ticket.length);
- cleanticket:
     free(tempcred->ticket.data);
  cleanaddrs:
     krb5_free_addresses(context, tempcred->addresses);