diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-09-19 14:48:23 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-09-23 11:41:45 +0200 |
commit | f0bc7fe3b75d2ae4aedb6da6f68ebb87f77d929b (patch) | |
tree | 0dd2af0249c63b01ace23715f2a7fc84082b90c4 /hw/usb | |
parent | 31376776d045c7ee0a1570c139ef30b6cb8f5b01 (diff) | |
download | qemu-f0bc7fe3b75d2ae4aedb6da6f68ebb87f77d929b.tar.gz qemu-f0bc7fe3b75d2ae4aedb6da6f68ebb87f77d929b.tar.bz2 qemu-f0bc7fe3b75d2ae4aedb6da6f68ebb87f77d929b.zip |
usb-storage: fix possible memory leak and missing error message
When scsi_bus_legacy_add_drive() return NULL, meanwhile err will
be not NULL, which will casue memory leak and missing error message.
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/dev-storage.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index eb75f6adb9..55ef6848a7 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -624,6 +624,8 @@ static int usb_msd_initfn_storage(USBDevice *dev) s->conf.bootindex, dev->serial, &err); if (!scsi_dev) { + error_report("%s", error_get_pretty(err)); + error_free(err); return -1; } s->bus.qbus.allow_hotplug = 0; |