Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource leak #807

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/entropy/dyn_entropy_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ rstatus_t entropy_key_iv_load(struct context *ctx) {
FILE *iv_file = fopen(iv_file_name, "r");
if (iv_file == NULL) {
log_error("opening iv.pem file failed %s", pool->recon_iv_file);
close(key_file);
return DN_ERROR;
}

Expand All @@ -365,12 +366,14 @@ rstatus_t entropy_key_iv_load(struct context *ctx) {
if (fstat(fd, &file_stat) < 0) /* Get the file size */
{
log_error("Error fstat --> %s", strerror(errno));
close(iv_file);
return DN_ERROR;
}

if (file_stat.st_size >
BUFFER_SIZE) { /* Compare file size with BUFFER_SIZE */
log_error("key file size is bigger then the buffer size");
close(iv_file);
return DN_ERROR;
}

Expand Down