vhost: fix double free on device stop
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 21 Jun 2011 17:34:17 +0000 (20:34 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 17 Jul 2011 15:47:33 +0000 (18:47 +0300)
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 <mst@redhat.com>
hw/vhost.c

index 80f771e..c3d8821 100644 (file)
@@ -784,5 +784,6 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
 
     hdev->started = false;
     qemu_free(hdev->log);
+    hdev->log = NULL;
     hdev->log_size = 0;
 }