summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2015-06-03 23:03:53 +0200
committerGerd Hoffmann <kraxel@redhat.com>2015-06-15 12:42:48 +0200
commit49dd6d0d33e1a59b4055713079e64062bc5092b5 (patch)
tree37fadd33b0184110e980cb4b0351d93b435c5621 /audio
parentf2dcc6cec285938967446d412b0477e02e26f3ca (diff)
paaudio: fix possible resource leak
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 <DirtY.iCE.hu@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r--audio/paaudio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 35e8887112..fea607166f 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;
}