diff --git a/lib/gssapi/mech/gss_init_sec_context.c b/lib/gssapi/mech/gss_init_sec_context.c index 79750142d..04d16d33b 100644 --- a/lib/gssapi/mech/gss_init_sec_context.c +++ b/lib/gssapi/mech/gss_init_sec_context.c @@ -88,6 +88,11 @@ gss_init_sec_context(OM_uint32 * minor_status, * Find the MN for this mechanism. */ mn = _gss_find_mn(name, mech_type); + if (mn == NULL) { + if (allocated_ctx) + free(ctx); + return GSS_S_BAD_NAME; + } /* * If we have a cred, find the cred for this mechanism.