decoder/gme: use AtScopeExit()

This commit is contained in:
Max Kellermann 2016-11-10 12:04:05 +01:00
parent 256ee7a8c7
commit 6a78d11127

View File

@ -25,6 +25,7 @@
#include "tag/TagHandler.hxx"
#include "fs/Path.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/ScopeExit.hxx"
#include "util/FormatString.hxx"
#include "util/AllocatedString.hxx"
#include "util/UriUtil.hxx"
@ -141,6 +142,8 @@ gme_file_decode(Decoder &decoder, Path path_fs)
return;
}
AtScopeExit(emu) { gme_delete(emu); };
FormatDebug(gme_domain, "emulator type '%s'\n",
gme_type_system(gme_type(emu)));
@ -153,7 +156,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
gme_err = gme_track_info(emu, &ti, container.track);
if (gme_err != nullptr) {
LogWarning(gme_domain, gme_err);
gme_delete(emu);
return;
}
@ -172,7 +174,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
SampleFormat::S16, GME_CHANNELS,
error)) {
LogError(error);
gme_delete(emu);
return;
}
@ -209,8 +210,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
if (gme_track_ended(emu))
break;
} while (cmd != DecoderCommand::STOP);
gme_delete(emu);
}
static void