bdev/virtio/blk: fix memory leaks on device init failure
Change-Id: I43dfe7f7067a7344922f4dfbdce34b72754b9c0a Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/405914 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
5e98dfd126
commit
c2520346bf
@ -448,12 +448,14 @@ virtio_pci_blk_dev_create(const char *name, struct virtio_pci_ctx *pci_ctx)
|
||||
free(default_name);
|
||||
|
||||
if (rc != 0) {
|
||||
free(vdev);
|
||||
free(bvdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = virtio_dev_reset(vdev, VIRTIO_BLK_DEV_SUPPORTED_FEATURES);
|
||||
if (rc != 0) {
|
||||
virtio_dev_destruct(vdev);
|
||||
free(bvdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user