Merge branch 'master' of ssh://moonshot.suchdamage.org:822/srv/git/moonshot
[mech_eap.git] / delete_sec_context.c
index 75b09f1..4f11148 100644 (file)
  * SUCH DAMAGE.
  */
 
+/*
+ * Release a context handle.
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -65,8 +69,10 @@ gss_delete_sec_context(OM_uint32 *minor,
 
         major = gssEapWrapOrGetMIC(minor, ctx, FALSE, FALSE,
                                    iov, 2, TOK_TYPE_DELETE_CONTEXT);
-        if (GSS_ERROR(major))
+        if (GSS_ERROR(major)) {
+            GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
             return major;
+        }
     }
 
     GSSEAP_MUTEX_UNLOCK(&ctx->mutex);