Release default credentials before exiting krb5_gss_init_sec_context routine
authorZhanna Tsitkov <tsitkova@mit.edu>
Tue, 9 Dec 2008 16:09:18 +0000 (16:09 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Tue, 9 Dec 2008 16:09:18 +0000 (16:09 +0000)
Ticket: 6294

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

src/lib/gssapi/krb5/init_sec_context.c

index 40bc0bcbd43435b86ec8fd013ee9377ad4d7f371..aee355d774ed2cf42adcba70682a4aecbb8ceb73 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- mode: c; indent-tabs-mode: nil -*- */
 /*
- * Copyright 2000,2002, 2003, 2007 by the Massachusetts Institute of Technology.
+ * Copyright 2000,2002, 2003, 2007, 2008 by the Massachusetts Institute of Technology.
  * All Rights Reserved.
  *
  * Export of this software from the United States of America may
@@ -902,6 +902,8 @@ krb5_gss_init_sec_context(minor_status, claimant_cred_handle,
     }
     kerr = k5_mutex_lock(&cred->lock);
     if (kerr) {
+        if (claimant_cred_handle == GSS_C_NO_CREDENTIAL)
+            krb5_gss_release_cred(minor_status, (gss_cred_id_t *)&cred);
         krb5_free_context(context);
         *minor_status = kerr;
         return GSS_S_FAILURE;