[PATCH] ima-evm-utils: Fix possible DIR leak in find

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DIR is not closed if chdir errors occur.

Signed-off-by: Vitaly Chikunov <vt@xxxxxxxxxxxx>
---
 src/evmctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/evmctl.c b/src/evmctl.c
index 53711f4..b65139b 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1344,6 +1344,7 @@ static int find(const char *path, int dts, find_cb_t func)
 
 	if (fchdir(dirfd(dir))) {
 		log_err("Failed to chdir %s\n", path);
+		closedir(dir);
 		return -1;
 	}
 
@@ -1359,6 +1360,7 @@ static int find(const char *path, int dts, find_cb_t func)
 
 	if (chdir("..")) {
 		log_err("Failed to chdir: %s\n", path);
+		closedir(dir);
 		return -1;
 	}
 
-- 
2.11.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux