Skip to contentSkip to conversation

ima-evm-utils: Fix possible DIR leak in find

PATCH New Vitaly Chikunov 1 participant 1 message Sep 1, 2019 Keys-trusted

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ima-evm-utils: Fix possible DIR leak in find

DIR is not closed if chdir errors occur.

---
 src/evmctl.c | 2 ++
 1 file changed, 2 insertions(+)
src/evmctl.c +2 -0
index 53711f4..b65139b 100644
@@ -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;
 	}
 
Signature · 1 line
2.11.0