fix: codex 清理

Close #I4BL3S

Signed-off-by: Far <yesiyuan2@huawei.com>
This commit is contained in:
Far 2021-09-27 11:42:17 +08:00
parent ecd9ca7781
commit 9ab3e351d3
2 changed files with 12 additions and 0 deletions

View File

@ -404,6 +404,8 @@ int VnodeLookupAt(const char *path, struct Vnode **result, uint32_t flags, struc
*result = currentVnode;
if (currentVnode->filePath == NULL) {
currentVnode->filePath = normalizedPath;
} else {
free(normalizedPath);
}
return ret;
} else if (VfsVnodePermissionCheck(currentVnode, EXEC_OP)) {

View File

@ -76,6 +76,10 @@ static int OsELFClose(int procFd)
int ret;
/* Process procfd convert to system global procfd */
int sysfd = DisassociateProcessFd(procFd);
if (sysfd < 0) {
return -EBADF;
}
ret = close(sysfd);
if (ret < 0) {
AssociateSystemFd(procFd, sysfd);
@ -120,6 +124,10 @@ STATIC INT32 OsReadELFInfo(INT32 procfd, UINT8 *buffer, size_t readSize, off_t o
ssize_t byteNum;
off_t returnPos;
INT32 fd = GetAssociatedSystemFd(procfd);
if (fd < 0) {
PRINT_ERR("%s[%d], Invalid procfd!\n", __FUNCTION__, __LINE__);
return LOS_NOK;
}
if (readSize > 0) {
returnPos = lseek(fd, offset, SEEK_SET);
@ -218,6 +226,8 @@ STATIC INT32 OsReadEhdr(const CHAR *fileName, ELFInfo *elfInfo, BOOL isExecFile)
ret = fs_getfilep(GetAssociatedSystemFd(elfInfo->procfd), &OsCurrProcessGet()->execFile);
if (ret) {
PRINT_ERR("%s[%d], Failed to get struct file %s!\n", __FUNCTION__, __LINE__, fileName);
/* File will be closed by OsLoadELFFile */
return ret;
}
}
#endif