[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 10/12] paaudio: fix possible resource leak
From: |
Kővágó, Zoltán |
Subject: |
[Qemu-devel] [PATCH v2 10/12] paaudio: fix possible resource leak |
Date: |
Wed, 3 Jun 2015 12:49:10 +0200 |
qpa_audio_init did not clean up resources properly if the initialization
failed. This hopefully fixes it.
Signed-off-by: Kővágó, Zoltán <address@hidden>
---
audio/paaudio.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 35e8887..fea6071 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -47,6 +47,8 @@ typedef struct {
paaudio *g;
} PAVoiceIn;
+static void qpa_audio_fini(void *opaque);
+
static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...)
{
va_list ap;
@@ -814,6 +816,8 @@ static void *qpa_audio_init (void)
{
paaudio *g = g_malloc(sizeof(paaudio));
g->conf = glob_conf;
+ g->mainloop = NULL;
+ g->context = NULL;
g->mainloop = pa_threaded_mainloop_new ();
if (!g->mainloop) {
@@ -867,7 +871,7 @@ unlock_and_fail:
pa_threaded_mainloop_unlock (g->mainloop);
fail:
AUD_log (AUDIO_CAP, "Failed to initialize PA context");
- g_free(g);
+ qpa_audio_fini(g);
return NULL;
}
--
2.4.2
- [Qemu-devel] [PATCH v2 00/12] Audio backend cleanup, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 01/12] audio: remove esd backend, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 04/12] audio: expose drv_opaque to init_out and init_in, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 08/12] wavaudio: do not use global variables, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 02/12] audio: remove fmod backend, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 03/12] audio: remove winwave audio driver, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 05/12] alsaaudio: do not use global variables, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 06/12] paaudio: do not use global variables, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 10/12] paaudio: fix possible resource leak,
Kővágó, Zoltán <=
- [Qemu-devel] [PATCH v2 07/12] ossaudio: do not use global variables, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 11/12] coreaudio: do not use global variables where possible, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 12/12] sdlaudio: do not allow multiple instances, Kővágó, Zoltán, 2015/06/03
- [Qemu-devel] [PATCH v2 09/12] dsoundaudio: do not use global variables, Kővágó, Zoltán, 2015/06/03
- Re: [Qemu-devel] [PATCH v2 00/12] Audio backend cleanup, Gerd Hoffmann, 2015/06/03