Skip to contentSkip to conversation

virtio-input: fix memory leak on unrealize

PATCH New Marc-André Lureau 1 participant 1 message Nov 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 virtio-input: fix memory leak on unrealize

Spotted by ASAN + minor stylistic change.

---

Michael: can you peek this in your next pullreq? thanks

hw/input/virtio-input.c | 3 +++

 1 file changed, 3 insertions(+)
hw/input/virtio-input.c +3 -0
index 51617a5885..ec54e46ad6 100644
@@ -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);
 }
 
Signature · 1 line
2.24.0