From 5c075210d6d1007d833e47f3a888cfcca75c4e37 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 9 Nov 2016 11:49:21 +0100 Subject: [PATCH] output/osx: use AtScopeExit() to call CFRelease() --- src/output/plugins/OSXOutputPlugin.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx index 4805f99b8..5d58f410b 100644 --- a/src/output/plugins/OSXOutputPlugin.cxx +++ b/src/output/plugins/OSXOutputPlugin.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "OSXOutputPlugin.hxx" #include "../OutputAPI.hxx" +#include "util/ScopeExit.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "thread/Mutex.hxx" @@ -445,6 +446,11 @@ osx_output_set_device(OSXOutput *oo, Error &error) char name[256]; unsigned int i; + AtScopeExit(&cfname) { + if (cfname) + CFRelease(cfname); + }; + if (oo->component_subtype != kAudioUnitSubType_HALOutput) goto done; @@ -537,8 +543,6 @@ osx_output_set_device(OSXOutput *oo, Error &error) done: delete[] deviceids; - if (cfname) - CFRelease(cfname); return ret; }