From a7b09d3d1ce3ada362c765217633f4da9c36ce63 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Thu, 23 Oct 2014 23:19:40 +0200
Subject: [PATCH] OutputThread: close the output plugin after filter failure

Fixes memory leak because ao_plugin_close() never gets called.
---
 NEWS                        | 2 ++
 src/output/OutputThread.cxx | 1 +
 2 files changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index b34598ee9..789453005 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 ver 0.19.2 (not yet released)
+* output
+  - fix memory leak after filter initialization error
 * fix assertion failure on unsupported PCM conversion
 
 ver 0.19.1 (2014/10/19)
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx
index d26b2da67..54664bb65 100644
--- a/src/output/OutputThread.cxx
+++ b/src/output/OutputThread.cxx
@@ -188,6 +188,7 @@ AudioOutput::Open()
 			    name, plugin.name);
 
 		mutex.unlock();
+		ao_plugin_close(this);
 		CloseFilter();
 		mutex.lock();