diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index ad90d6edce..173d26f525 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -89,6 +89,7 @@ next_subdir: if (oldinode == newinode) { + inode_release(newinode); ret = OK; goto errout; /* Bad naming, this is not an error case. */ } @@ -113,6 +114,8 @@ next_subdir: FAR char *subdirname; FAR char *tmp; + inode_release(newinode); + /* Yes.. In this case, the target of the rename must be a * subdirectory of newinode, not the newinode itself. For * example: mv b a/ must move b to a/b.