krb5_context: embed mutex in structure

Instead of allocating a separate mutex object on the heap,
include the HEIMDAL_MUTEX in the krb5_context structure.

Change-Id: If6db484177410487176985e43e3b43e0f2166518
This commit is contained in:
Nicolas Williams
2016-03-31 22:06:37 -05:00
committed by Jeffrey Altman
parent 1f53a40827
commit c80816f9c3
5 changed files with 20 additions and 38 deletions

View File

@@ -623,10 +623,10 @@ krb5_get_error_string(krb5_context context)
{
char *ret = NULL;
HEIMDAL_MUTEX_lock(context->mutex);
HEIMDAL_MUTEX_lock(&context->mutex);
if (context->error_string)
ret = strdup(context->error_string);
HEIMDAL_MUTEX_unlock(context->mutex);
HEIMDAL_MUTEX_unlock(&context->mutex);
return ret;
}
@@ -635,9 +635,9 @@ krb5_have_error_string(krb5_context context)
KRB5_DEPRECATED_FUNCTION("Use krb5_get_error_message instead")
{
char *str;
HEIMDAL_MUTEX_lock(context->mutex);
HEIMDAL_MUTEX_lock(&context->mutex);
str = context->error_string;
HEIMDAL_MUTEX_unlock(context->mutex);
HEIMDAL_MUTEX_unlock(&context->mutex);
return str != NULL;
}