decoder/audiofile: use AtScopeExit()
This commit is contained in:
parent
07a51957ee
commit
256ee7a8c7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user