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