@@ -1318,12 +1318,23 @@ static void virtio_snd_reset(VirtIODevice *vdev)
{
VirtIOSound *s = VIRTIO_SND(vdev);
virtio_snd_ctrl_command *cmd;
+ uint32_t i;
while (!QTAILQ_EMPTY(&s->cmdq)) {
cmd = QTAILQ_FIRST(&s->cmdq);
QTAILQ_REMOVE(&s->cmdq, cmd, next);
virtio_snd_ctrl_cmd_free(cmd);
}
+
+ for (i = 0; i < s->snd_conf.streams; i++) {
+ VirtIOSoundPCMStream *stream = &s->streams[i];
+ VirtIOSoundPCMBuffer *buffer;
+
+ while ((buffer = QSIMPLEQ_FIRST(&stream->queue))) {
+ QSIMPLEQ_REMOVE_HEAD(&stream->queue, entry);
+ virtio_snd_pcm_buffer_free(buffer);
+ }
+ }
}
static void virtio_snd_class_init(ObjectClass *klass, void *data)
All remaining stream buffers in the stream queues must be freed after a reset. This is the initial state of the virtio-sound device. Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> --- hw/audio/virtio-snd.c | 11 +++++++++++ 1 file changed, 11 insertions(+)