aboutsummaryrefslogtreecommitdiff
path: root/lib/krb5/kcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/krb5/kcm.c')
-rw-r--r--lib/krb5/kcm.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/krb5/kcm.c b/lib/krb5/kcm.c
index 5a28b5138b5f..557dc5fe419c 100644
--- a/lib/krb5/kcm.c
+++ b/lib/krb5/kcm.c
@@ -553,9 +553,7 @@ kcm_get_first (krb5_context context,
c = calloc(1, sizeof(*c));
if (c == NULL) {
- ret = ENOMEM;
- krb5_set_error_message(context, ret,
- N_("malloc: out of memory", ""));
+ ret = krb5_enomem(context);
return ret;
}
@@ -577,9 +575,7 @@ kcm_get_first (krb5_context context,
if (ptr == NULL) {
free(c->uuids);
free(c);
- krb5_set_error_message(context, ENOMEM,
- N_("malloc: out of memory", ""));
- return ENOMEM;
+ return krb5_enomem(context);
}
c->uuids = ptr;
@@ -788,9 +784,7 @@ kcm_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
c = calloc(1, sizeof(*c));
if (c == NULL) {
- ret = ENOMEM;
- krb5_set_error_message(context, ret,
- N_("malloc: out of memory", ""));
+ ret = krb5_enomem(context);
goto out;
}
@@ -819,9 +813,7 @@ kcm_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
ptr = realloc(c->uuids, sizeof(c->uuids[0]) * (c->length + 1));
if (ptr == NULL) {
- ret = ENOMEM;
- krb5_set_error_message(context, ret,
- N_("malloc: out of memory", ""));
+ ret = krb5_enomem(context);
goto out;
}
c->uuids = ptr;
@@ -963,6 +955,7 @@ kcm_get_default_name(krb5_context context, const krb5_cc_ops *ops,
krb5_storage *request, *response;
krb5_data response_data;
char *name;
+ int aret;
*str = NULL;
@@ -981,9 +974,9 @@ kcm_get_default_name(krb5_context context, const krb5_cc_ops *ops,
if (ret)
return ret;
- asprintf(str, "%s:%s", ops->prefix, name);
+ aret = asprintf(str, "%s:%s", ops->prefix, name);
free(name);
- if (str == NULL)
+ if (aret == -1 || str == NULL)
return ENOMEM;
return 0;