From 2626034fff67c160cfdc814e46771a54fcadda3b Mon Sep 17 00:00:00 2001 From: kuloud Date: Tue, 10 Mar 2020 17:27:30 +0800 Subject: [PATCH] Fix inputFile resource leak #27 --- linux/src/plugin/AOECrypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux/src/plugin/AOECrypto.c b/linux/src/plugin/AOECrypto.c index 359e141..7fa73e7 100644 --- a/linux/src/plugin/AOECrypto.c +++ b/linux/src/plugin/AOECrypto.c @@ -43,6 +43,7 @@ int AOECrypto_decryptAoeFile_cbc(const char *srcFile, const char *dstFile, const FILE *filewrite = fopen(dstFile, "w+"); if (NULL == filewrite) { + fclose(inputFile); return -1; } @@ -135,6 +136,7 @@ int AOECrypto_decryptAoeFile_cbc_mem(const char *srcFile, char **dstMem, const c char *response = (char *)malloc(fileOrgLengh); if (NULL == response) { + fclose(inputFile); return -1; } @@ -212,6 +214,7 @@ int AOECrypto_encryptAoeFile_Version1(const char *srcFile, const char *dstFile) FILE *filewrite = fopen(dstFile, "w+"); if (NULL == filewrite) { + fclose(file); return -1; }