In update_disk_super_on_device,the buffer size is small, allocate it
onstack and get rid of one error path.
Signed-off-by: David Sterba <dsterba@suse.com>
char fs_uuid[BTRFS_UUID_SIZE];
u64 devid, type, io_align, io_width;
u64 sector_size, total_bytes, bytes_used;
- char *buf = NULL;
+ char buf[BTRFS_SUPER_INFO_SIZE];
int fp = -1;
int ret;
goto out;
}
- buf = malloc(BTRFS_SUPER_INFO_SIZE);
- if (!buf) {
- ret = -ENOMEM;
- close(fp);
- return ret;
- }
-
memcpy(buf, info->super_copy, BTRFS_SUPER_INFO_SIZE);
disk_super = (struct btrfs_super_block *)buf;
write_backup_supers(fp, (u8 *)buf);
out:
- free(buf);
if (fp != -1)
close(fp);
return ret;