tmpfs:fix memoryleak of tmpfs_opendir
Build / Fetch-Source (push) Has been cancelled
Build / Linux-Arch (push) Has been cancelled
Build / Linux (push) Has been cancelled
Build / OOT-Build (push) Has been cancelled
Build / macOS-Arch (push) Has been cancelled
Build / macOS (push) Has been cancelled
Build / msys2-Arch (push) Has been cancelled
Build / msys2 (push) Has been cancelled
Build / msvc-Arch (push) Has been cancelled
Build / msvc (push) Has been cancelled

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 Alan C. Assis
parent fcee238c86
commit cac1be9e74
+6 -2
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;
}