From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDlh-0007DA-RG for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlDld-0008R1-1F for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlDlc-0008Qv-R5 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 04:17:40 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA39He2i018884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 3 Nov 2014 04:17:40 -0500 Message-ID: <54574831.1090704@redhat.com> Date: Mon, 03 Nov 2014 10:17:37 +0100 From: Max Reitz MIME-Version: 1.0 References: <1414669826-21550-1-git-send-email-famz@redhat.com> <54574273.8090606@redhat.com> <20141103091731.GA709@fam-t430.nay.redhat.com> In-Reply-To: <20141103091731.GA709@fam-t430.nay.redhat.com> Content-Type: text/plain; charset=windows-1252; 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 Cc: Paolo Bonzini , qemu-devel@nongnu.org, stefanha@redhat.com, "Michael S. Tsirkin" On 2014-11-03 at 10:17, Fam Zheng wrote: > 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 Ah, okay. :-) Max