Add a new function virtio_blk__delete() goes through array of block
devices and releases memory allocated for block device.
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
void virtio_blk__init(struct kvm *kvm, struct disk_image *disk);
void virtio_blk__init_all(struct kvm *kvm);
+void virtio_blk__delete_all(struct kvm *kvm);
#endif /* KVM__BLK_VIRTIO_H */
exit_code = 1;
}
+ virtio_blk__delete_all(kvm);
+
disk_image__close_all(kvm->disks, image_count);
kvm__delete(kvm);
for (i = 0; i < kvm->nr_disks; i++)
virtio_blk__init(kvm, kvm->disks[i]);
}
+
+void virtio_blk__delete_all(struct kvm *kvm)
+{
+ int i;
+
+ for (i = 0; i < kvm->nr_disks; i++)
+ free(bdevs[i]);
+}