[DFS_V1] 修复close失败后不释放fd导致内存被永久占用且无法释放 (#7907)
This commit is contained in:
parent
d5c9dc09a0
commit
b3831246c2
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user