qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-stable] [Qemu-devel] [PATCH] virtio-scsi-dataplane: fix memory


From: Fam Zheng
Subject: Re: [Qemu-stable] [Qemu-devel] [PATCH] virtio-scsi-dataplane: fix memory leak in virtio_scsi_vring_init
Date: Wed, 18 Mar 2015 09:47:33 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, 03/18 09:42, Bo Su wrote:
> if k->set_host_notifier failed, VirtIOSCSIVring *r will leak
> 
> Signed-off-by: Bo Su <address@hidden>
> ---
>  hw/scsi/virtio-scsi-dataplane.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
> index 3f40ff0..c069cd7 100644
> --- a/hw/scsi/virtio-scsi-dataplane.c
> +++ b/hw/scsi/virtio-scsi-dataplane.c
> @@ -45,7 +45,7 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI 
> *s,
>  {
>      BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
>      VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
> -    VirtIOSCSIVring *r = g_slice_new(VirtIOSCSIVring);
> +    VirtIOSCSIVring *r;
>      int rc;
>  
>      /* Set up virtqueue notify */
> @@ -56,6 +56,8 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI 
> *s,
>          s->dataplane_fenced = true;
>          return NULL;
>      }
> +
> +    r = g_slice_new(VirtIOSCSIVring);
>      r->host_notifier = *virtio_queue_get_host_notifier(vq);
>      r->guest_notifier = *virtio_queue_get_guest_notifier(vq);
>      aio_set_event_notifier(s->ctx, &r->host_notifier, handler);
> -- 
> 1.8.5
> 
> 

Reviewed-by: Fam Zheng <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]