mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-08 08:33:19 +00:00
cpukit/dosfs: Don't leak a FAT FD
The tmp_fat_fd variable is unconditionally opened in the branch where it is used within the loop and so must be closed or else risk a resource leak.
This commit is contained in:
committed by
Joel Sherrill
parent
3626fe833d
commit
487cdce64d
@@ -339,14 +339,14 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count)
|
|||||||
iop->offset = iop->offset + sizeof(struct dirent);
|
iop->offset = iop->offset + sizeof(struct dirent);
|
||||||
cmpltd += (sizeof(struct dirent));
|
cmpltd += (sizeof(struct dirent));
|
||||||
count -= (sizeof(struct dirent));
|
count -= (sizeof(struct dirent));
|
||||||
|
}
|
||||||
|
|
||||||
/* inode number extracted, close fat-file */
|
/* inode number extracted, close fat-file */
|
||||||
rc = fat_file_close(&fs_info->fat, tmp_fat_fd);
|
rc = fat_file_close(&fs_info->fat, tmp_fat_fd);
|
||||||
if (rc != RC_OK)
|
if (rc != RC_OK)
|
||||||
{
|
{
|
||||||
msdos_fs_unlock(fs_info);
|
msdos_fs_unlock(fs_info);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user