Use correct socket glue and try to maintain constness

This commit is contained in:
Asanka Herath
2009-12-21 18:05:39 -05:00
parent 4eb90e1c8c
commit 16faee892e

View File

@@ -245,22 +245,25 @@ cc_ops_register(krb5_context context)
static krb5_error_code
cc_ops_copy(krb5_context context, const krb5_context src_context)
{
krb5_cc_ops **cc_ops;
context->cc_ops = NULL;
context->num_cc_ops = 0;
if (src_context->num_cc_ops == 0)
return 0;
context->cc_ops = malloc(sizeof(context->cc_ops[0]) * src_context->num_cc_ops);
if (context->cc_ops == NULL) {
cc_ops = malloc(sizeof(cc_ops[0]) * src_context->num_cc_ops);
if (cc_ops == NULL) {
krb5_set_error_message(context, KRB5_CC_NOMEM,
N_("malloc: out of memory", ""));
return KRB5_CC_NOMEM;
}
memcpy(cc_ops, src_context->cc_ops,
sizeof(cc_ops[0]) * src_context->num_cc_ops);
context->cc_ops = cc_ops;
context->num_cc_ops = src_context->num_cc_ops;
memcpy(context->cc_ops, src_context->cc_ops,
sizeof(context->cc_ops[0]) * src_context->num_cc_ops);
return 0;
}
@@ -537,17 +540,9 @@ krb5_free_context(krb5_context context)
HEIMDAL_MUTEX_destroy(context->mutex);
free(context->mutex);
<<<<<<< HEAD
if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) {
rk_SOCK_EXIT();
}
=======
#ifdef NEED_SOCK_INIT
if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) {
SOCK_EXIT;
}
#endif
>>>>>>> h-github/master
memset(context, 0, sizeof(*context));
free(context);