Use krb5_enomem() more consistently in lib/krb5.
This commit is contained in:
@@ -657,11 +657,8 @@ encode_creds(krb5_context context, krb5_creds *creds, krb5_data *data)
|
||||
krb5_storage *sp;
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (sp == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
ret = krb5_store_creds(sp, creds);
|
||||
if (ret) {
|
||||
@@ -687,11 +684,8 @@ decode_creds(krb5_context context, const void *data, size_t length,
|
||||
krb5_storage *sp;
|
||||
|
||||
sp = krb5_storage_from_readonly_mem(data, length);
|
||||
if (sp == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (sp == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
ret = krb5_ret_creds(sp, creds);
|
||||
krb5_storage_free(sp);
|
||||
@@ -881,11 +875,8 @@ scc_get_first (krb5_context context,
|
||||
*cursor = NULL;
|
||||
|
||||
ctx = calloc(1, sizeof(*ctx));
|
||||
if (ctx == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (ctx == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
ret = make_database(context, s);
|
||||
if (ret) {
|
||||
@@ -904,19 +895,15 @@ scc_get_first (krb5_context context,
|
||||
ret = asprintf(&name, "credIteration%pPid%d",
|
||||
ctx, (int)getpid());
|
||||
if (ret < 0 || name == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
||||
if (ret < 0 || ctx->drop == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
free(name);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s "
|
||||
@@ -926,7 +913,7 @@ scc_get_first (krb5_context context,
|
||||
free(ctx->drop);
|
||||
free(name);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = exec_stmt(context, s->db, str, KRB5_CC_IO);
|
||||
@@ -1160,11 +1147,8 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
||||
*cursor = NULL;
|
||||
|
||||
ctx = calloc(1, sizeof(*ctx));
|
||||
if (ctx == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (ctx == NULL)
|
||||
return krb5_enomem(context);
|
||||
|
||||
ret = default_db(context, &ctx->db);
|
||||
if (ctx->db == NULL) {
|
||||
@@ -1175,33 +1159,27 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
||||
ret = asprintf(&name, "cacheIteration%pPid%d",
|
||||
ctx, (int)getpid());
|
||||
if (ret < 0 || name == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
sqlite3_close(ctx->db);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = asprintf(&ctx->drop, "DROP TABLE %s", name);
|
||||
if (ret < 0 || ctx->drop == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
sqlite3_close(ctx->db);
|
||||
free(name);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = asprintf(&str, "CREATE TEMPORARY TABLE %s AS SELECT name FROM caches",
|
||||
name);
|
||||
if (ret < 0 || str == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
sqlite3_close(ctx->db);
|
||||
free(name);
|
||||
free(ctx->drop);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = exec_stmt(context, ctx->db, str, KRB5_CC_IO);
|
||||
@@ -1223,7 +1201,7 @@ scc_get_cache_first(krb5_context context, krb5_cc_cursor *cursor)
|
||||
free(name);
|
||||
free(ctx->drop);
|
||||
free(ctx);
|
||||
return ENOMEM;
|
||||
return krb5_enomem(context);
|
||||
}
|
||||
|
||||
ret = prepare_stmt(context, ctx->db, &ctx->stmt, str);
|
||||
@@ -1372,11 +1350,8 @@ scc_get_default_name(krb5_context context, char **str)
|
||||
|
||||
ret = asprintf(str, "SCC:%s", name);
|
||||
free(name);
|
||||
if (ret < 0 || *str == NULL) {
|
||||
krb5_set_error_message(context, ENOMEM,
|
||||
N_("malloc: out of memory", ""));
|
||||
return ENOMEM;
|
||||
}
|
||||
if (ret < 0 || *str == NULL)
|
||||
return krb5_enomem(context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user