From 915c5442d10fec04cfdcea639f1e9086a2461167 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 8 Jul 2022 12:03:26 +0200 Subject: [PATCH] input/CdioParanoia: use AtScopeExit() for cdio_free_device_list() --- src/input/plugins/CdioParanoiaInputPlugin.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index 0cbaca248..55cc2a5a4 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -30,6 +30,7 @@ #include "util/RuntimeError.hxx" #include "util/Domain.hxx" #include "util/ByteOrder.hxx" +#include "util/ScopeExit.hxx" #include "fs/AllocatedPath.hxx" #include "Log.hxx" #include "config/Block.hxx" @@ -173,9 +174,9 @@ cdio_detect_device() if (devices == nullptr) return nullptr; - AllocatedPath path = AllocatedPath::FromFS(devices[0]); - cdio_free_device_list(devices); - return path; + AtScopeExit(devices) { cdio_free_device_list(devices); }; + + return AllocatedPath::FromFS(devices[0]); } static InputStreamPtr