Skip to content

Commit

Permalink
audio: Free consumed default audio devices
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Marc-André Lureau <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
akihikodaki authored and bonzini committed Nov 24, 2023
1 parent 541069e commit e4b9d19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
break;
}
QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next);
qapi_free_Audiodev(dev);
s->dev = NULL;
}
}

Expand Down

0 comments on commit e4b9d19

Please sign in to comment.