!764 realPath内存泄露

Merge pull request !764 from tl/master
This commit is contained in:
openharmony_ci 2024-01-19 13:27:14 +00:00 committed by Gitee
commit 8afec72b2f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 3 additions and 0 deletions

View File

@ -285,6 +285,7 @@ static int ReadKeyFile(const char *path, char *buf, size_t len)
}
int fd = open(realPath, O_RDONLY);
free(realPath);
if (fd < 0) {
FSCRYPT_LOGE("key file read open failed");
return -EFAULT;

View File

@ -141,6 +141,7 @@ static uint8_t CheckKernelFscrypt(const char *mnt)
}
int fd = open(realPath, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
free(realPath);
if (fd < 0) {
FSCRYPT_LOGE("open policy file failed, errno: %d", errno);
return FSCRYPT_INVALID;

View File

@ -230,6 +230,7 @@ int32_t QuotaManager::SetQuotaPrjId(const std::string &path, int32_t prjId, bool
}
int fd = open(realPath, O_RDONLY | O_CLOEXEC);
free(realPath);
if (fd < 0) {
LOGE("Failed to open %{public}s, errno: %{public}d", path.c_str(), errno);
return E_SYS_CALL;