Commit f0bc7fe3 authored by Gonglei's avatar Gonglei Committed by Gerd Hoffmann

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 <>
Signed-off-by: default avatarGonglei <>
Reviewed-by: default avatarPaolo Bonzini <>
Signed-off-by: default avatarGerd Hoffmann <>
parent 31376776
......@@ -624,6 +624,8 @@ static int usb_msd_initfn_storage(USBDevice *dev)
s->conf.bootindex, dev->serial,
if (!scsi_dev) {
error_report("%s", error_get_pretty(err));
return -1;
s->bus.qbus.allow_hotplug = 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment