mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-26 08:02:21 +00:00
btrfs-progs: use on-stack variable in __rebuild_device_items
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
7ae478d8af
commit
416d39c48a
@ -1191,13 +1191,10 @@ static int __rebuild_device_items(struct btrfs_trans_handle *trans,
|
||||
{
|
||||
struct btrfs_device *dev;
|
||||
struct btrfs_key key;
|
||||
struct btrfs_dev_item *dev_item;
|
||||
struct btrfs_dev_item dev_item_tmp;
|
||||
struct btrfs_dev_item *dev_item = &dev_item_tmp;
|
||||
int ret = 0;
|
||||
|
||||
dev_item = malloc(sizeof(struct btrfs_dev_item));
|
||||
if (!dev_item)
|
||||
return -ENOMEM;
|
||||
|
||||
list_for_each_entry(dev, &rc->fs_devices->devices, dev_list) {
|
||||
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
||||
key.type = BTRFS_DEV_ITEM_KEY;
|
||||
@ -1218,7 +1215,6 @@ static int __rebuild_device_items(struct btrfs_trans_handle *trans,
|
||||
dev_item, sizeof(*dev_item));
|
||||
}
|
||||
|
||||
free(dev_item);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user