Use krb5_enomem() more consistently in lib/krb5.

This commit is contained in:
Roland C. Dowdeswell
2013-02-13 16:15:00 +08:00
parent edae63418e
commit f0f07ff408
62 changed files with 393 additions and 837 deletions

View File

@@ -60,18 +60,13 @@ krb5_get_init_creds_opt_alloc(krb5_context context,
*opt = NULL;
o = calloc(1, sizeof(*o));
if (o == NULL) {
krb5_set_error_message(context, ENOMEM,
N_("malloc: out of memory", ""));
return ENOMEM;
}
if (o == NULL)
return krb5_enomem(context);
o->opt_private = calloc(1, sizeof(*o->opt_private));
if (o->opt_private == NULL) {
krb5_set_error_message(context, ENOMEM,
N_("malloc: out of memory", ""));
free(o);
return ENOMEM;
return krb5_enomem(context);
}
o->opt_private->refcount = 1;
*opt = o;
@@ -423,10 +418,8 @@ krb5_get_init_creds_opt_get_error(krb5_context context,
KRB5_DEPRECATED_FUNCTION("Use X instead")
{
*error = calloc(1, sizeof(**error));
if (*error == NULL) {
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
return ENOMEM;
}
if (*error == NULL)
return krb5_enomem(context);
return 0;
}