From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDO1-0005xY-CG for qemu-devel@nongnu.org; Mon, 03 Nov 2014 03:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlDNv-0002KC-7Y for qemu-devel@nongnu.org; Mon, 03 Nov 2014 03:53:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDNv-0002K4-0l for qemu-devel@nongnu.org; Mon, 03 Nov 2014 03:53:11 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA38rAZw001170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 3 Nov 2014 03:53:10 -0500 Message-ID: <54574273.8090606@redhat.com> Date: Mon, 03 Nov 2014 09:53:07 +0100 From: Max Reitz MIME-Version: 1.0 References: <1414669826-21550-1-git-send-email-famz@redhat.com> In-Reply-To: <1414669826-21550-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-scsi: Fix memory leak when realize failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Paolo Bonzini , stefanha@redhat.com, "Michael S. Tsirkin" On 2014-10-30 at 12:50, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > hw/scsi/virtio-scsi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c > index a1725b8..4aae1e8 100644 > --- a/hw/scsi/virtio-scsi.c > +++ b/hw/scsi/virtio-scsi.c > @@ -793,6 +793,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp, > error_setg(errp, "Invalid number of queues (= %" PRId32 "), " > "must be a positive integer less than %d.", > s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX); > + virtio_cleanup(vdev); > return; > } > s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *)); The alternative would be to simply push virtio_init() below this check, but it's fine either way. Reviewed-by: Max Reitz