fs_msync:Fix crash caused under the anonymous mapping

Summary:
 Limitations of using fs putfile

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-06-19 18:20:43 +08:00 committed by Xiang Xiao
parent d04205aa3d
commit c9148fbb0a

View File

@ -286,7 +286,11 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
ret = file_mmap_(filep, start, length,
prot, flags, offset, MAP_USER, &mapped);
fs_putfilep(filep);
if (filep)
{
fs_putfilep(filep);
}
if (ret < 0)
{
goto errout;