169b9a
From b79ac72e8192d3f1036a7027ffed668399183be5 Mon Sep 17 00:00:00 2001
169b9a
From: Tarun Gupta <tgupta@redhat.com>
169b9a
Date: Wed, 20 Jun 2018 18:54:20 +0200
169b9a
Subject: [PATCH 12/17] vfio/common: cleanup in vfio_region_finalize
169b9a
169b9a
RH-Author: Tarun Gupta <tgupta@redhat.com>
169b9a
Message-id: <1529520865-18127-7-git-send-email-tgupta@redhat.com>
169b9a
Patchwork-id: 80910
169b9a
O-Subject: [RHEL7.6 qemu-kvm PATCH v3 06/11] vfio/common: cleanup in vfio_region_finalize
169b9a
Bugzilla: 1555246
169b9a
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
169b9a
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
169b9a
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
169b9a
169b9a
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
169b9a
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
169b9a
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
169b9a
169b9a
(cherry picked from 92f86bff088dc6f0c0ed93b8e82d4d2459c35145)
169b9a
169b9a
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
169b9a
---
169b9a
 hw/misc/vfio.c | 7 +++++++
169b9a
 1 file changed, 7 insertions(+)
169b9a
169b9a
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
169b9a
index 68ff949..414b689 100644
169b9a
--- a/hw/misc/vfio.c
169b9a
+++ b/hw/misc/vfio.c
169b9a
@@ -2798,6 +2798,13 @@ static void vfio_region_finalize(VFIORegion *region)
169b9a
     g_free(region->mmaps);
169b9a
 
169b9a
     trace_vfio_region_finalize(region->vbasedev->name, region->nr);
169b9a
+
169b9a
+    region->mem = NULL;
169b9a
+    region->mmaps = NULL;
169b9a
+    region->nr_mmaps = 0;
169b9a
+    region->size = 0;
169b9a
+    region->flags = 0;
169b9a
+    region->nr = 0;
169b9a
 }
169b9a
 
169b9a
 static void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled)
169b9a
-- 
169b9a
1.8.3.1
169b9a