mirror of https://github.com/RT-Thread/rt-thread
[dfs]释放fd_slot之前将子节点释放避免内存泄漏 (#7378)
This commit is contained in:
parent
62dcc50530
commit
efbdeb25ee
|
@ -359,6 +359,11 @@ void fdt_fd_release(struct dfs_fdtable* fdt, int fd)
|
||||||
if (vnode)
|
if (vnode)
|
||||||
{
|
{
|
||||||
vnode->ref_count--;
|
vnode->ref_count--;
|
||||||
|
if(vnode->ref_count == 0)
|
||||||
|
{
|
||||||
|
rt_free(vnode);
|
||||||
|
fd_slot->vnode = RT_NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rt_free(fd_slot);
|
rt_free(fd_slot);
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,6 +359,11 @@ void fdt_fd_release(struct dfs_fdtable* fdt, int fd)
|
||||||
if (vnode)
|
if (vnode)
|
||||||
{
|
{
|
||||||
vnode->ref_count--;
|
vnode->ref_count--;
|
||||||
|
if(vnode->ref_count == 0)
|
||||||
|
{
|
||||||
|
rt_free(vnode);
|
||||||
|
fd_slot->vnode = RT_NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rt_free(fd_slot);
|
rt_free(fd_slot);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue