mirror of https://github.com/proxmox/mirror_qemu
usb: release the created buses
Leaks spotted by ASAN. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>master
parent
675f22c6d3
commit
cd7bc87868
|
@ -589,6 +589,13 @@ static const struct SCSIBusInfo usb_msd_scsi_info_bot = {
|
||||||
.load_request = usb_msd_load_request,
|
.load_request = usb_msd_load_request,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void usb_msd_unrealize_storage(USBDevice *dev, Error **errp)
|
||||||
|
{
|
||||||
|
MSDState *s = USB_STORAGE_DEV(dev);
|
||||||
|
|
||||||
|
object_unref(OBJECT(&s->bus));
|
||||||
|
}
|
||||||
|
|
||||||
static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
|
static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
MSDState *s = USB_STORAGE_DEV(dev);
|
MSDState *s = USB_STORAGE_DEV(dev);
|
||||||
|
@ -635,6 +642,13 @@ static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
|
||||||
s->scsi_dev = scsi_dev;
|
s->scsi_dev = scsi_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void usb_msd_unrealize_bot(USBDevice *dev, Error **errp)
|
||||||
|
{
|
||||||
|
MSDState *s = USB_STORAGE_DEV(dev);
|
||||||
|
|
||||||
|
object_unref(OBJECT(&s->bus));
|
||||||
|
}
|
||||||
|
|
||||||
static void usb_msd_realize_bot(USBDevice *dev, Error **errp)
|
static void usb_msd_realize_bot(USBDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
MSDState *s = USB_STORAGE_DEV(dev);
|
MSDState *s = USB_STORAGE_DEV(dev);
|
||||||
|
@ -755,6 +769,7 @@ static void usb_msd_class_initfn_storage(ObjectClass *klass, void *data)
|
||||||
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
uc->realize = usb_msd_realize_storage;
|
uc->realize = usb_msd_realize_storage;
|
||||||
|
uc->unrealize = usb_msd_unrealize_storage;
|
||||||
dc->props = msd_properties;
|
dc->props = msd_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,6 +832,7 @@ static void usb_msd_class_initfn_bot(ObjectClass *klass, void *data)
|
||||||
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
uc->realize = usb_msd_realize_bot;
|
uc->realize = usb_msd_realize_bot;
|
||||||
|
uc->unrealize = usb_msd_unrealize_bot;
|
||||||
uc->attached_settable = true;
|
uc->attached_settable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -896,6 +896,8 @@ static void usb_uas_unrealize(USBDevice *dev, Error **errp)
|
||||||
UASDevice *uas = USB_UAS(dev);
|
UASDevice *uas = USB_UAS(dev);
|
||||||
|
|
||||||
qemu_bh_delete(uas->status_bh);
|
qemu_bh_delete(uas->status_bh);
|
||||||
|
|
||||||
|
object_unref(OBJECT(&uas->bus));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usb_uas_realize(USBDevice *dev, Error **errp)
|
static void usb_uas_realize(USBDevice *dev, Error **errp)
|
||||||
|
|
Loading…
Reference in New Issue