Commit 6a78d111 authored by Max Kellermann's avatar Max Kellermann

decoder/gme: use AtScopeExit()

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