]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio-input: fix memory leak on unrealize
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 21 Nov 2019 09:56:49 +0000 (13:56 +0400)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 25 Nov 2019 08:19:36 +0000 (03:19 -0500)
Spotted by ASAN + minor stylistic change.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20191121095649.25453-1-marcandre.lureau@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
hw/input/virtio-input.c

index 51617a5885f69fe816106df5d6c7d5a6043e32aa..ec54e46ad6703ddacad196f0889458eda72eb967 100644 (file)
@@ -275,6 +275,7 @@ static void virtio_input_finalize(Object *obj)
 
     g_free(vinput->queue);
 }
+
 static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
 {
     VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
@@ -288,6 +289,8 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
             return;
         }
     }
+    virtio_del_queue(vdev, 0);
+    virtio_del_queue(vdev, 1);
     virtio_cleanup(vdev);
 }