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:
Kinsey Moore
2024-01-16 13:04:14 -06:00
committed by Joel Sherrill
parent 3626fe833d
commit 487cdce64d

View File

@@ -339,14 +339,14 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count)
iop->offset = iop->offset + sizeof(struct dirent);
cmpltd += (sizeof(struct dirent));
count -= (sizeof(struct dirent));
}
/* inode number extracted, close fat-file */
rc = fat_file_close(&fs_info->fat, tmp_fat_fd);
if (rc != RC_OK)
{
msdos_fs_unlock(fs_info);
return rc;
}
/* inode number extracted, close fat-file */
rc = fat_file_close(&fs_info->fat, tmp_fat_fd);
if (rc != RC_OK)
{
msdos_fs_unlock(fs_info);
return rc;
}
}