[DFS_V1] 修复close失败后不释放fd导致内存被永久占用且无法释放 (#7907)

This commit is contained in:
Junjie Wang
2023-08-03 15:42:54 +08:00
committed by GitHub
parent d5c9dc09a0
commit b3831246c2
3 changed files with 4 additions and 14 deletions
@@ -491,11 +491,9 @@ int dfs_elm_close(struct dfs_file *file)
RT_ASSERT(fd != RT_NULL);
result = f_close(fd);
if (result == FR_OK)
{
/* release memory */
rt_free(fd);
}
/* release memory */
rt_free(fd);
}
return elm_result_to_dfs(result);
-7
View File
@@ -309,13 +309,6 @@ int dfs_file_close(struct dfs_file *fd)
result = vnode->fops->close(fd);
}
/* close fd error, return */
if (result < 0)
{
dfs_fm_unlock();
return result;
}
if (vnode->ref_count == 1)
{
/* remove from hash */
+1 -2
View File
@@ -146,6 +146,7 @@ int close(int fd)
}
result = dfs_file_close(d);
fd_release(fd);
if (result < 0)
{
@@ -154,8 +155,6 @@ int close(int fd)
return -1;
}
fd_release(fd);
return 0;
}
RTM_EXPORT(close);