From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] audio: Free consumed default audio devices
Date: Mon, 20 Nov 2023 20:53:56 +0900 [thread overview]
Message-ID: <cbb32a8b-b72c-46fc-ac12-e2252857bca4@daynix.com> (raw)
In-Reply-To: <CAJ+F1C+p87y5b23x87W-rVm8a9Y9UqDiPd_HsfhkGtYffZ3ksQ@mail.gmail.com>
On 2023/11/20 20:35, Marc-André Lureau wrote:
> Hi
>
> On Mon, Nov 20, 2023 at 3:29 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>>
>> Failed default audio devices were removed from the list but not freed,
>> and that made LeakSanitizer sad. Free default audio devices as they are
>> consumed.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>
> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
>> ---
>> V1 -> V2: Set s->dev NULL after free (Marc-André Lureau)
>>
>> audio/audio.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/audio/audio.c b/audio/audio.c
>> index f91e05b72c..8d1e4ad922 100644
>> --- a/audio/audio.c
>> +++ b/audio/audio.c
>> @@ -1758,12 +1758,15 @@ static AudioState *audio_init(Audiodev *dev, Error **errp)
>> goto out;
>> }
>> s->dev = dev = e->dev;
>> + QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next);
>> + g_free(e);
>> drvname = AudiodevDriver_str(dev->driver);
>> driver = audio_driver_lookup(drvname);
>> if (!audio_driver_init(s, driver, dev, NULL)) {
>
> Maybe it would be clearer/safer to set s->dev in audio_driver_init() on success.
I considered that too, but I decided not to that because
audio_driver_init() takes s and may expect s->dev is initialized.
next prev parent reply other threads:[~2023-11-20 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 11:28 [PATCH v2] audio: Free consumed default audio devices Akihiko Odaki
2023-11-20 11:35 ` Marc-André Lureau
2023-11-20 11:53 ` Akihiko Odaki [this message]
2023-11-20 21:20 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbb32a8b-b72c-46fc-ac12-e2252857bca4@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).