Use krb5_enomem() more consistently in lib/krb5.
This commit is contained in:
@@ -383,9 +383,8 @@ krb5_cc_get_full_name(krb5_context context,
|
||||
}
|
||||
|
||||
if (asprintf(str, "%s:%s", type, name) == -1) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
*str = NULL;
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -554,10 +553,8 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
|
||||
context->default_cc_name_set = 1;
|
||||
}
|
||||
|
||||
if (p == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (p == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
ret = _krb5_expand_path_tokens(context, p, &exp_p);
|
||||
free(p);
|
||||
@@ -606,10 +603,8 @@ krb5_cc_default(krb5_context context,
|
||||
{
|
||||
const char *p = krb5_cc_default_name(context);
|
||||
|
||||
if (p == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (p == NULL)
|
||||
return krb5_enomem(context);
|
||||
return krb5_cc_resolve(context, p, id);
|
||||
}
|
||||
|
||||
@@ -989,7 +984,7 @@ krb5_cc_get_prefix_ops(krb5_context context, const char *prefix)
|
||||
|
||||
p = strdup(prefix);
|
||||
if (p == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
krb5_enomem(context);
|
||||
return NULL;
|
||||
}
|
||||
p1 = strchr(p, ':');
|
||||
@@ -1053,10 +1048,8 @@ krb5_cc_cache_get_first (krb5_context context,
|
||||
}
|
||||
|
||||
*cursor = calloc(1, sizeof(**cursor));
|
||||
if (*cursor == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (*cursor == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
(*cursor)->ops = ops;
|
||||
|
||||
@@ -1388,10 +1381,8 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor)
|
||||
{
|
||||
*cursor = calloc(1, sizeof(**cursor));
|
||||
if (*cursor == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (*cursor == NULL)
|
||||
return krb5_enomem(context);
|
||||
(*cursor)->idx = 0;
|
||||
(*cursor)->cursor = NULL;
|
||||
|
||||
@@ -1577,10 +1568,9 @@ krb5_cc_get_friendly_name(krb5_context context,
|
||||
} else {
|
||||
ret = asprintf(name, "%.*s", (int)data.length, (char *)data.data);
|
||||
krb5_data_free(&data);
|
||||
if (ret <= 0) {
|
||||
ret = ENOMEM;
|
||||
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
|
||||
} else
|
||||
if (ret <= 0)
|
||||
ret = krb5_enomem(context);
|
||||
else
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user