lib/kadm5: find_db_spec do not leak 'info'

If a memory allocation failure occurs 'info' is leaked.

Change-Id: Ie9cfff3f7d63a1af8e053d47d5ff66411916a795
This commit is contained in:
Jeffrey Altman
2022-01-16 21:03:00 -05:00
parent 1247ca977c
commit 3065730b8a

View File

@@ -161,29 +161,37 @@ find_db_spec(kadm5_server_context *ctx)
p = hdb_dbinfo_get_dbname(context, d);
if (p) {
ctx->config.dbname = strdup(p);
if (ctx->config.dbname == NULL)
if (ctx->config.dbname == NULL) {
hdb_free_dbinfo(context, &info);
return krb5_enomem(context);
}
}
p = hdb_dbinfo_get_acl_file(context, d);
if (p) {
ctx->config.acl_file = strdup(p);
if (ctx->config.acl_file == NULL)
if (ctx->config.acl_file == NULL) {
hdb_free_dbinfo(context, &info);
return krb5_enomem(context);
}
}
p = hdb_dbinfo_get_mkey_file(context, d);
if (p) {
ctx->config.stash_file = strdup(p);
if (ctx->config.stash_file == NULL)
if (ctx->config.stash_file == NULL) {
hdb_free_dbinfo(context, &info);
return krb5_enomem(context);
}
}
p = hdb_dbinfo_get_log_file(context, d);
if (p) {
ctx->log_context.log_file = strdup(p);
if (ctx->log_context.log_file == NULL)
if (ctx->log_context.log_file == NULL) {
hdb_free_dbinfo(context, &info);
return krb5_enomem(context);
}
}
break;
}