From efbdeb25ee7f10f47f7dfcac62b5a5c6a544aecc Mon Sep 17 00:00:00 2001 From: goldengrandpa <74250839+guoguozi123456@users.noreply.github.com> Date: Wed, 26 Apr 2023 08:47:21 +0800 Subject: [PATCH] =?UTF-8?q?[dfs]=E9=87=8A=E6=94=BEfd=5Fslot=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E5=B0=86=E5=AD=90=E8=8A=82=E7=82=B9=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=20(#7378?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/dfs_v1/src/dfs.c | 5 +++++ components/dfs/dfs_v2/src/dfs.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/components/dfs/dfs_v1/src/dfs.c b/components/dfs/dfs_v1/src/dfs.c index ecab062d7a..5487b1c012 100644 --- a/components/dfs/dfs_v1/src/dfs.c +++ b/components/dfs/dfs_v1/src/dfs.c @@ -359,6 +359,11 @@ void fdt_fd_release(struct dfs_fdtable* fdt, int fd) if (vnode) { vnode->ref_count--; + if(vnode->ref_count == 0) + { + rt_free(vnode); + fd_slot->vnode = RT_NULL; + } } rt_free(fd_slot); } diff --git a/components/dfs/dfs_v2/src/dfs.c b/components/dfs/dfs_v2/src/dfs.c index ecab062d7a..5487b1c012 100644 --- a/components/dfs/dfs_v2/src/dfs.c +++ b/components/dfs/dfs_v2/src/dfs.c @@ -359,6 +359,11 @@ void fdt_fd_release(struct dfs_fdtable* fdt, int fd) if (vnode) { vnode->ref_count--; + if(vnode->ref_count == 0) + { + rt_free(vnode); + fd_slot->vnode = RT_NULL; + } } rt_free(fd_slot); }