Commit 256ee7a8 authored by Max Kellermann's avatar Max Kellermann

decoder/audiofile: use AtScopeExit()

parent 07a51957
......@@ -23,6 +23,7 @@
#include "input/InputStream.hxx"
#include "CheckAudioFormat.hxx"
#include "tag/TagHandler.hxx"
#include "util/ScopeExit.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
......@@ -195,6 +196,8 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
if (fh == AF_NULL_FILEHANDLE)
return;
AtScopeExit(fh) { afCloseFile(fh); };
Error error;
AudioFormat audio_format;
if (!audio_format_init_checked(audio_format,
......@@ -203,7 +206,6 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
afGetVirtualChannels(fh, AF_DEFAULT_TRACK),
error)) {
LogError(error);
afCloseFile(fh);
return;
}
......@@ -240,8 +242,6 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
cmd = DecoderCommand::NONE;
}
} while (cmd == DecoderCommand::NONE);
afCloseFile(fh);
}
gcc_pure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment