From c9168018b429b9210bd3b5da400c31e4c8b2c075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kleber=20Tarc=C3=ADsio?= Date: Mon, 14 Mar 2022 03:00:24 -0300 Subject: [PATCH] fix resource leak fix resource leak --- src/entropy/dyn_entropy_util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/entropy/dyn_entropy_util.c b/src/entropy/dyn_entropy_util.c index 755135731..34ae84a35 100644 --- a/src/entropy/dyn_entropy_util.c +++ b/src/entropy/dyn_entropy_util.c @@ -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; } @@ -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; }