qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Kővágó, Zoltán" <DirtY.iCE.hu@gmail.com>
Subject: [Qemu-devel] [PULL 10/20] paaudio: fix possible resource leak
Date: Mon, 15 Jun 2015 14:28:01 +0200	[thread overview]
Message-ID: <1434371291-6994-11-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1434371291-6994-1-git-send-email-kraxel@redhat.com>

From: Kővágó, Zoltán <dirty.ice.hu@gmail.com>

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>
---
 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;
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2015-06-15 12:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 12:27 [Qemu-devel] [PULL 00/20] audio patch queue Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 01/20] audio: remove esd backend Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 02/20] audio: remove fmod backend Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 03/20] audio: remove winwave audio driver Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 04/20] only enable dsound in case the header file is present Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 05/20] audio: expose drv_opaque to init_out and init_in Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 06/20] paaudio: do not use global variables Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 07/20] alsaaudio: " Gerd Hoffmann
2015-06-15 12:27 ` [Qemu-devel] [PULL 08/20] ossaudio: " Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 09/20] wavaudio: " Gerd Hoffmann
2015-06-15 12:28 ` Gerd Hoffmann [this message]
2015-06-15 12:28 ` [Qemu-devel] [PULL 11/20] dsoundaudio: " Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 12/20] coreaudio: do not use global variables where possible Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 13/20] sdlaudio: do not allow multiple instances Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 14/20] MAINTAINERS: remove malc from audio Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 15/20] audio: remove LOG_TO_MONITOR along with default_mon Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 16/20] audio: remove plive Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 17/20] dsoundaudio: remove *_retries kludges Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 18/20] dsoundaudio: remove primary buffer Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 19/20] alsaaudio: use trace events instead of verbose Gerd Hoffmann
2015-06-15 12:28 ` [Qemu-devel] [PULL 20/20] ossaudio: use trace events instead of debug config flag Gerd Hoffmann
2015-06-15 17:03 ` [Qemu-devel] [PULL 00/20] audio patch queue Peter Maydell
2015-06-15 17:05   ` Peter Maydell
2015-06-16  7:50     ` Gerd Hoffmann

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=1434371291-6994-11-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=DirtY.iCE.hu@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).