Il 18/09/2014 11:32, arei.gong...@huawei.com ha scritto:
> From: Gonglei <arei.gong...@huawei.com>
> 
> 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 <arm...@redhat.com>
> Signed-off-by: Gonglei <arei.gong...@huawei.com>
> ---
>  hw/usb/dev-storage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index ae4efcb..f731b0a 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;
> 

Reviewed-by: Paolo Bonzini <pbonz...@redhat.com>

Reply via email to