Received: from eggs.gnu.org ([2001:4830:134:3::10]:54695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDlH-0006iF-D4 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlDl9-0008Jb-VH for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDl9-0008JX-OE for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17: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 sA39HB4A008958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 3 Nov 2014 04:17:11 -0500 Date: Mon, 3 Nov 2014 17:17:31 +0800 From: Fam Zheng Message-ID: <20141103091731.GA709@fam-t430.nay.redhat.com> References: <1414669826-21550-1-git-send-email-famz@redhat.com> <54574273.8090606@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54574273.8090606@redhat.com> 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: Max Reitz Cc: Paolo Bonzini , qemu-devel@nongnu.org, stefanha@redhat.com, "Michael S. Tsirkin" On Mon, 11/03 09:53, Max Reitz wrote: > 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 > Thanks, Paolo has sent a PULL req for this: http://lists.gnu.org/archive/html/qemu-devel/2014-10/msg04113.html Fam