mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:41:29 +08:00
fs: pseudorename should call inode_release in the error path
to avoid the memory leak Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I8f7e4c8fb89188614d03dcf383a1707f25c65174
This commit is contained in:
committed by
Gustavo Henrique Nihei
parent
1e3a985155
commit
643ee82e9c
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user