diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-02-25 16:54:42 -0600 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-02-27 14:39:42 +0100 |
commit | 2e23e290cab6182e60e65f5eea1c07b66c077ec9 (patch) | |
tree | 1b41f4bcba0095444b838ab25eea4252837ff0e4 /disk-io.c | |
parent | d310e9cfffe0154d05ba2c8774241341307a6c76 (diff) | |
download | btrfs-progs-2e23e290cab6182e60e65f5eea1c07b66c077ec9.tar.gz |
btrfs-progs: free memory before error exit in read_whole_eb
Free the memory allocated to "multi" before the error
exit in read_whole_eb(). Set it to NULL after we free
it in the loop to avoid any potential double-free.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r-- | disk-io.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -198,17 +198,21 @@ static int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, i mirror, NULL); if (ret) { printk("Couldn't map the block %Lu\n", eb->start + offset); + kfree(multi); return -EIO; } device = multi->stripes[0].dev; - if (device->fd == 0) + if (device->fd == 0) { + kfree(multi); return -EIO; + } eb->fd = device->fd; device->total_ios++; eb->dev_bytenr = multi->stripes[0].physical; kfree(multi); + multi = NULL; if (read_len > bytes_left) read_len = bytes_left; |