[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] vhost: fix double free on device stop
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PATCH] vhost: fix double free on device stop |
Date: |
Tue, 21 Jun 2011 20:10:45 +0300 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
vhost dev stop failed to clear the log field.
Typically not an issue as dev start overwrites this field,
but if logging gets disabled before the following start,
it doesn't so this causes a double free.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/vhost.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 80f771e..1fbf2e5 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -784,5 +784,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice
*vdev)
hdev->started = false;
qemu_free(hdev->log);
+ if (hdev->log) {
+ qemu_free(hdev->log);
+ }
+ hdev->log = NULL;
hdev->log_size = 0;
}
--
1.7.5.53.gc233e
- [Qemu-devel] [PATCH] vhost: fix double free on device stop,
Michael S. Tsirkin <=