You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/hw/audio
Paolo Bonzini 626b39006d hw/audio/hda: fix memory leak on audio setup
When SET_STREAM_FORMAT is called, the st->buft timer is overwritten, thus
causing a memory leak.  This was originally fixed in commit 816139ae6a5
("hw/audio/hda: fix memory leak on audio setup", 2024-11-14) but that
caused the audio to break in SPICE.

Fortunately, a simpler fix is possible.  The timer only needs to be
reset, because the callback is always the same (st->output is set at
realize time in hda_audio_init); call to timer_new_ns overkill.  Replace
it with timer_del and only initialize the timer once; for simplicity,
do it even if use_timer is false.

An even simpler fix would be to free the old time in hda_audio_setup().
However, it seems better to place the initialization of the timer close
to that of st->ouput.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20241114125318.1707590-3-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks ago
..
Kconfig Add virtio-sound device stub 1 year ago
ac97.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
ac97.h hw/audio/ac97: Split off some definitions to a header 2 years ago
adlib.c audio: propagate Error * out of audio_init 1 year ago
asc.c hw, target: Add ResetType argument to hold and exit phase methods 7 months ago
cs4231.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
cs4231a.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
es1370.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
fmopl.c audio: spelling fixes 1 year ago
fmopl.h audio: spelling fixes 1 year ago
gus.c hw/audio: Constify VMState 11 months ago
gusemu.h audio: GUSsample is int16_t 8 years ago
gusemu_hal.c audio: spelling fixes 1 year ago
gusemu_mixer.c hw/audio/gus: Fix registers 32-bit access 5 years ago
gustate.h Clean up decorations and whitespace around header guards 9 years ago
hda-codec-common.h hda-codec: make mixemu selectable at runtime 11 years ago
hda-codec.c hw/audio/hda: fix memory leak on audio setup 2 weeks ago
intel-hda-defs.h audio: spelling fixes 1 year ago
intel-hda.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
intel-hda.h hw/audio: Simplify hda audio init 1 year ago
lm4549.c hw/audio: Constify VMState 11 months ago
lm4549.h hw/audio/lm4549: Add errp error reporting to init function 1 year ago
marvell_88w8618.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
meson.build Add virtio-sound-pci device 1 year ago
pcspk.c hw/audio: Constify VMState 11 months ago
pl041.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
pl041.h Clean up decorations and whitespace around header guards 9 years ago
pl041.hx
sb16.c hw/audio/sb16: Do not migrate qdev properties 11 months ago
soundhw.c replace error_setg(&error_fatal, ...) with error_report() 1 month ago
trace-events hw/audio/virtio-sound: fix heap buffer overflow 3 months ago
trace.h trace: switch position of headers to what Meson requires 4 years ago
via-ac97.c hw: Use device_class_set_legacy_reset() instead of opencoding 3 months ago
virtio-snd-pci.c hw/audio/virtio-snd-pci: fix the PCI class code 1 year ago
virtio-snd.c hw/audio/virtio-snd: Remove unnecessary "exec/tswap.h" header 2 months ago
wm8750.c hw/audio: Constify VMState 11 months ago