tmpfs:fix memoryleak of tmpfs_opendir

fix the memory leak in tmpfs_opendir

Signed-off-by: guohao15 <guohao15@xiaomi.com>
This commit is contained in:
guohao15
2025-07-08 17:34:30 +08:00
committed by Matteo Golin
parent 0d1eb67f20
commit fe7201245b

View File

@@ -2047,14 +2047,18 @@ static int tmpfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
{
tdir->tf_tdo = tdo;
tdir->tf_index = tdo->tdo_nentries;
*dir = &tdir->tf_base;
tmpfs_unlock_directory(tdo);
}
/* Release the lock on the file system and return the result */
tmpfs_unlock(fs);
*dir = &tdir->tf_base;
if (ret < 0)
{
fs_heap_free(tdir);
}
return ret;
}