Received: from eggs.gnu.org ([2001:4830:134:3::10]:42950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPWDl-0001pJ-1g for qemu-devel@nongnu.org; Wed, 12 Aug 2015 09:37:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPWDf-0002b9-Vv for qemu-devel@nongnu.org; Wed, 12 Aug 2015 09:37:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPWDf-0002b1-RA for qemu-devel@nongnu.org; Wed, 12 Aug 2015 09:37:27 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 6AB808E4FB for ; Wed, 12 Aug 2015 13:37:27 +0000 (UTC) From: Paolo Bonzini Date: Wed, 12 Aug 2015 15:36:59 +0200 Message-Id: <1439386633-18933-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1439386633-18933-1-git-send-email-pbonzini@redhat.com> References: <1439386633-18933-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 06/20] vhost/scsi: call vhost_dev_cleanup() at unrealize() time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov From: Igor Mammedov vhost-scsi calls vhost_dev_init() at realize() time but forgets to call it's counterpart vhost_dev_cleanup() at unrealize() time. Calling it should fix leaking of memory table and mem_sections table in vhost device. And also unregister vhost's memory listerner to prevent access from memory core to freed memory. Signed-off-by: Igor Mammedov Message-Id: <1438262999-287627-1-git-send-email-imammedo@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/vhost-scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index a69918b..0dd57ff 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -277,6 +277,7 @@ static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) /* This will stop vhost backend. */ vhost_scsi_set_status(vdev, 0); + vhost_dev_cleanup(&s->dev); g_free(s->dev.vqs); virtio_scsi_common_unrealize(dev, errp); -- 2.4.3