mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +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,6 +339,7 @@ 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);
|
||||
@@ -348,7 +349,6 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count <= 0)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user