Use krb5_enomem() more consistently in lib/krb5.
This commit is contained in:
@@ -50,16 +50,13 @@ krb5_auth_con_init(krb5_context context,
|
||||
krb5_auth_context p;
|
||||
|
||||
ALLOC(p, 1);
|
||||
if(!p) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (!p)
|
||||
return krb5_enomem(context);
|
||||
memset(p, 0, sizeof(*p));
|
||||
ALLOC(p->authenticator, 1);
|
||||
if (!p->authenticator) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
free(p);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
memset (p->authenticator, 0, sizeof(*p->authenticator));
|
||||
p->flags = KRB5_AUTH_CONTEXT_DO_TIME;
|
||||
@@ -159,7 +156,7 @@ krb5_auth_con_setaddrs(krb5_context context,
|
||||
krb5_free_address (context, auth_context->local_address);
|
||||
else
|
||||
if ((auth_context->local_address = malloc(sizeof(krb5_address))) == NULL)
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
krb5_copy_address(context, local_addr, auth_context->local_address);
|
||||
}
|
||||
if (remote_addr) {
|
||||
@@ -167,7 +164,7 @@ krb5_auth_con_setaddrs(krb5_context context,
|
||||
krb5_free_address (context, auth_context->remote_address);
|
||||
else
|
||||
if ((auth_context->remote_address = malloc(sizeof(krb5_address))) == NULL)
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
krb5_copy_address(context, remote_addr, auth_context->remote_address);
|
||||
}
|
||||
return 0;
|
||||
@@ -264,10 +261,8 @@ krb5_auth_con_getaddrs(krb5_context context,
|
||||
if(*local_addr)
|
||||
krb5_free_address (context, *local_addr);
|
||||
*local_addr = malloc (sizeof(**local_addr));
|
||||
if (*local_addr == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (*local_addr == NULL)
|
||||
return krb5_enomem(context);
|
||||
krb5_copy_address(context,
|
||||
auth_context->local_address,
|
||||
*local_addr);
|
||||
@@ -276,10 +271,9 @@ krb5_auth_con_getaddrs(krb5_context context,
|
||||
krb5_free_address (context, *remote_addr);
|
||||
*remote_addr = malloc (sizeof(**remote_addr));
|
||||
if (*remote_addr == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
krb5_free_address (context, *local_addr);
|
||||
*local_addr = NULL;
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
krb5_copy_address(context,
|
||||
auth_context->remote_address,
|
||||
@@ -420,7 +414,7 @@ krb5_auth_con_setenctype(krb5_context context,
|
||||
krb5_free_keyblock(context, auth_context->keyblock);
|
||||
ALLOC(auth_context->keyblock, 1);
|
||||
if(auth_context->keyblock == NULL)
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
auth_context->keyblock->keytype = etype;
|
||||
return 0;
|
||||
}
|
||||
@@ -477,10 +471,8 @@ krb5_auth_con_getauthenticator(krb5_context context,
|
||||
krb5_authenticator *authenticator)
|
||||
{
|
||||
*authenticator = malloc(sizeof(**authenticator));
|
||||
if (*authenticator == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (*authenticator == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
copy_Authenticator(auth_context->authenticator,
|
||||
*authenticator);
|
||||
|
Reference in New Issue
Block a user