summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/virtio/vhost.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 5fd69f0b2e..ddc42f0f93 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -375,8 +375,6 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync)
     if (!log) {
         return;
     }
-    dev->log = NULL;
-    dev->log_size = 0;
 
     --log->refcnt;
     if (log->refcnt == 0) {
@@ -396,6 +394,9 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync)
 
         g_free(log);
     }
+
+    dev->log = NULL;
+    dev->log_size = 0;
 }
 
 static bool vhost_dev_log_is_shared(struct vhost_dev *dev)