Commit a84fbbe3 authored by Max Kellermann's avatar Max Kellermann

decoder/gme: free the gme_info_t as early as possible

parent 93c97972
...@@ -156,8 +156,11 @@ gme_file_decode(Decoder &decoder, Path path_fs) ...@@ -156,8 +156,11 @@ gme_file_decode(Decoder &decoder, Path path_fs)
return; return;
} }
const SignedSongTime song_len = ti->length > 0 const int length = ti->length;
? SignedSongTime::FromMS(ti->length) gme_free_info(ti);
const SignedSongTime song_len = length > 0
? SignedSongTime::FromMS(length)
: SignedSongTime::Negative(); : SignedSongTime::Negative();
/* initialize the MPD decoder */ /* initialize the MPD decoder */
...@@ -168,7 +171,6 @@ gme_file_decode(Decoder &decoder, Path path_fs) ...@@ -168,7 +171,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
SampleFormat::S16, GME_CHANNELS, SampleFormat::S16, GME_CHANNELS,
error)) { error)) {
LogError(error); LogError(error);
gme_free_info(ti);
gme_delete(emu); gme_delete(emu);
return; return;
} }
...@@ -179,8 +181,8 @@ gme_file_decode(Decoder &decoder, Path path_fs) ...@@ -179,8 +181,8 @@ gme_file_decode(Decoder &decoder, Path path_fs)
if (gme_err != nullptr) if (gme_err != nullptr)
LogWarning(gme_domain, gme_err); LogWarning(gme_domain, gme_err);
if (ti->length > 0) if (length > 0)
gme_set_fade(emu, ti->length); gme_set_fade(emu, length);
/* play */ /* play */
DecoderCommand cmd; DecoderCommand cmd;
...@@ -207,7 +209,6 @@ gme_file_decode(Decoder &decoder, Path path_fs) ...@@ -207,7 +209,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
break; break;
} while (cmd != DecoderCommand::STOP); } while (cmd != DecoderCommand::STOP);
gme_free_info(ti);
gme_delete(emu); gme_delete(emu);
} }
......
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