From 73cadd179847a4b3dfe9a023f81d6c7bf9dabe4e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 May 2016 15:05:48 +0200 Subject: [PATCH] output/shout: dispose encoder in destructor --- src/output/plugins/ShoutOutputPlugin.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx index 69bedfe33..287bdac88 100644 --- a/src/output/plugins/ShoutOutputPlugin.cxx +++ b/src/output/plugins/ShoutOutputPlugin.cxx @@ -44,7 +44,7 @@ struct ShoutOutput final { shout_t *shout_conn; shout_metadata_t *shout_meta; - Encoder *encoder; + Encoder *encoder = nullptr; float quality = -2.0; int bitrate = -1; @@ -81,6 +81,9 @@ ShoutOutput::~ShoutOutput() shout_init_count--; if (shout_init_count == 0) shout_shutdown(); + + if (encoder != nullptr) + encoder->Dispose(); } static const EncoderPlugin * @@ -365,9 +368,6 @@ static void my_shout_finish_driver(AudioOutput *ao) { ShoutOutput *sd = (ShoutOutput *)ao; - - sd->encoder->Dispose(); - delete sd; }