Fix several memory leaks.
* grub-core/fs/btrfs.c (grub_btrfs_dir): Fix memory leak. * grub-core/fs/cpio.c (grub_cpio_find_file): Likewise. (grub_cpio_dir): Likewise. * grub-core/fs/fat.c (grub_fat_label): Likewise. * grub-core/fs/jfs.c (grub_jfs_label): Likewise. * grub-core/fs/romfs.c (grub_romfs_close): Likewise. (grub_romfs_label): Likewise. * grub-core/fs/squash4.c (squash_mount): Use zalloc for safety. (squash_unmount): New function. (grub_squash_dir): Fix memory leak. (grub_squash_open): Likewise. (grub_squash_read): Likewise. (grub_squash_mtime): Likewise. * grub-core/fs/xfs.c (grub_xfs_open): Likewise. * grub-core/fs/zfs/zfs.c (check_pool_label): Likewise. * util/grub-fstest.c (fstest): Likewise.
This commit is contained in:
parent
57b0125004
commit
8a5a3a5b5a
10 changed files with 84 additions and 22 deletions
|
@ -1048,7 +1048,10 @@ grub_fat_label (grub_device_t device, char **label)
|
|||
grub_size_t chc;
|
||||
*label = grub_malloc (11 * 4 + 1);
|
||||
if (!*label)
|
||||
return grub_errno;
|
||||
{
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
chc = dir.type_specific.volume_label.character_count;
|
||||
if (chc > ARRAY_SIZE (dir.type_specific.volume_label.str))
|
||||
chc = ARRAY_SIZE (dir.type_specific.volume_label.str);
|
||||
|
@ -1057,6 +1060,7 @@ grub_fat_label (grub_device_t device, char **label)
|
|||
}
|
||||
}
|
||||
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue