mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 07:30:33 +00:00
Fix a bunch of grub coverity issues
This commit is contained in:
parent
fd73d78a75
commit
c813901698
@ -250,12 +250,16 @@ grub_cpio_dir (grub_device_t device, const char *path,
|
||||
info.dir = (p != NULL);
|
||||
|
||||
hook (name + len, &info, closure);
|
||||
if (prev)
|
||||
grub_free (prev);
|
||||
if (prev) {
|
||||
grub_free (prev);
|
||||
prev = NULL;
|
||||
}
|
||||
prev = name;
|
||||
}
|
||||
else
|
||||
else {
|
||||
grub_free (name);
|
||||
name = NULL;
|
||||
}
|
||||
}
|
||||
data->hofs = ofs;
|
||||
}
|
||||
|
@ -450,7 +450,8 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
grub_free (indir);
|
||||
}
|
||||
/* Double indirect. */
|
||||
else if (fileblock < INDIRECT_BLOCKS + blksz / 4 * (blksz / 4 + 1))
|
||||
else if (fileblock < (grub_disk_addr_t)(INDIRECT_BLOCKS + blksz / 4) \
|
||||
* (grub_disk_addr_t)(blksz / 4 + 1))
|
||||
{
|
||||
unsigned int perblock = blksz / 4;
|
||||
unsigned int rblock = fileblock - (INDIRECT_BLOCKS
|
||||
|
@ -652,8 +652,10 @@ list_file (struct grub_ntfs_file *diro, char *pos,
|
||||
fdiro->ino = u32at (pos, 0);
|
||||
|
||||
ustr = grub_malloc (ns * 4 + 1);
|
||||
if (ustr == NULL)
|
||||
if (ustr == NULL){
|
||||
grub_free(fdiro);
|
||||
return 0;
|
||||
}
|
||||
*grub_utf16_to_utf8 ((grub_uint8_t *) ustr, (grub_uint16_t *) np,
|
||||
ns) = '\0';
|
||||
|
||||
|
@ -658,7 +658,8 @@ grub_reiserfs_read_symlink (grub_fshelp_node_t node)
|
||||
|
||||
block_size = grub_le_to_cpu16 (node->data->superblock.block_size);
|
||||
len = grub_le_to_cpu16 (found.header.item_size);
|
||||
block = found.block_number * (block_size >> GRUB_DISK_SECTOR_BITS);
|
||||
block = (grub_disk_addr_t)found.block_number \
|
||||
* ((grub_disk_addr_t)block_size >> GRUB_DISK_SECTOR_BITS);
|
||||
offset = grub_le_to_cpu16 (found.header.item_location);
|
||||
|
||||
symlink_buffer = grub_malloc (len + 1);
|
||||
@ -1106,7 +1107,8 @@ grub_reiserfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
switch (found.type)
|
||||
{
|
||||
case GRUB_REISERFS_DIRECT:
|
||||
block = found.block_number * (block_size >> GRUB_DISK_SECTOR_BITS);
|
||||
block = (grub_disk_addr_t)found.block_number \
|
||||
* ((grub_disk_addr_t)block_size >> GRUB_DISK_SECTOR_BITS);
|
||||
grub_dprintf ("reiserfs_blocktype", "D: %u\n", (unsigned) block);
|
||||
if (initial_position < current_position + item_size)
|
||||
{
|
||||
|
@ -50,7 +50,6 @@ GrubFS *grubfs_new (struct grub_fs *myfs, void *data) {
|
||||
|
||||
grub_disk_t grubfs_disk (void *data) {
|
||||
struct grub_disk *disk = empty (sizeof (struct grub_disk));
|
||||
disk = empty (sizeof (struct grub_disk));
|
||||
disk->dev = empty (sizeof (struct grub_disk_dev));
|
||||
disk->dev->read = read_foo; // grub_disk_dev
|
||||
disk->data = data;
|
||||
|
@ -229,6 +229,10 @@ grub_partition_get_name (const grub_partition_t partition)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (out){
|
||||
grub_free(out);
|
||||
out = NULL;
|
||||
}
|
||||
curlen = strl;
|
||||
out = grub_strdup (buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user