[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.1.2 70/72] Revert "hw/audio/hda: fix memory leak on audio setu
From: |
Michael Tokarev |
Subject: |
[Stable-9.1.2 70/72] Revert "hw/audio/hda: fix memory leak on audio setup" |
Date: |
Tue, 19 Nov 2024 09:04:11 +0300 |
From: Paolo Bonzini <pbonzini@redhat.com>
This reverts commit 6d03242a7e47815ed56687ecd13f683d8da3f2fe,
which causes SPICE audio to break. While arguably this is a SPICE bug,
it is possible to fix the leak in a less heavy-handed way.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2639
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-2-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit e125d9835b89545b09c0367404dcf69f18ae6de1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 4373565371..ee3d0a7dec 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -472,24 +472,6 @@ static void hda_audio_set_amp(HDAAudioStream *st)
}
}
-static void hda_close_stream(HDAAudioState *a, HDAAudioStream *st)
-{
- if (st->node == NULL) {
- return;
- }
- if (a->use_timer) {
- timer_free(st->buft);
- st->buft = NULL;
- }
- if (st->output) {
- AUD_close_out(&a->card, st->voice.out);
- st->voice.out = NULL;
- } else {
- AUD_close_in(&a->card, st->voice.in);
- st->voice.in = NULL;
- }
-}
-
static void hda_audio_setup(HDAAudioStream *st)
{
bool use_timer = st->state->use_timer;
@@ -502,7 +484,6 @@ static void hda_audio_setup(HDAAudioStream *st)
trace_hda_audio_format(st->node->name, st->as.nchannels,
fmt2name[st->as.fmt], st->as.freq);
- hda_close_stream(st->state, st);
if (st->output) {
if (use_timer) {
cb = hda_audio_output_cb;
@@ -760,11 +741,23 @@ static void hda_audio_init(HDACodecDevice *hda,
static void hda_audio_exit(HDACodecDevice *hda)
{
HDAAudioState *a = HDA_AUDIO(hda);
+ HDAAudioStream *st;
int i;
dprint(a, 1, "%s\n", __func__);
for (i = 0; i < ARRAY_SIZE(a->st); i++) {
- hda_close_stream(a, a->st + i);
+ st = a->st + i;
+ if (st->node == NULL) {
+ continue;
+ }
+ if (a->use_timer) {
+ timer_free(st->buft);
+ }
+ if (st->output) {
+ AUD_close_out(&a->card, st->voice.out);
+ } else {
+ AUD_close_in(&a->card, st->voice.in);
+ }
}
AUD_remove_card(&a->card);
}
--
2.39.5
- [Stable-9.1.2 60/72] linux-user: Fix setreuid and setregid to use direct syscalls, (continued)
- [Stable-9.1.2 60/72] linux-user: Fix setreuid and setregid to use direct syscalls, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 61/72] target/arm: Drop user-only special case in sve_stN_r, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 63/72] linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 62/72] accel/tcg: Fix user-only probe_access_internal plugin check, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 65/72] linux-user/arm: Select vdso for be8 and be32 modes, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 66/72] tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc(), Michael Tokarev, 2024/11/19
- [Stable-9.1.2 64/72] linux-user/arm: Reduce vdso alignment to 4k, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 67/72] target/i386: fix hang when using slow path for ptw_setl, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 68/72] vfio/container: Fix container object destruction, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 69/72] hw/misc/mos6522: Fix bad class definition of the MOS6522 device, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 70/72] Revert "hw/audio/hda: fix memory leak on audio setup",
Michael Tokarev <=
- [Stable-9.1.2 71/72] hw/audio/hda: fix memory leak on audio setup, Michael Tokarev, 2024/11/19
- [Stable-9.1.2 72/72] usb-hub: Fix handling port power control messages, Michael Tokarev, 2024/11/19