Commit f0faf003 authored by Max Kellermann's avatar Max Kellermann

decoder/gme: allocate tag later, fixes memory leak

Allocate the "tag" object after the file has been opened successfully.
parent 51c7577c
...@@ -80,7 +80,6 @@ gme_file_decode(struct decoder *decoder, const char *path_fs) ...@@ -80,7 +80,6 @@ gme_file_decode(struct decoder *decoder, const char *path_fs)
static struct tag * static struct tag *
gme_tag_dup(const char *path_fs) gme_tag_dup(const char *path_fs)
{ {
struct tag *tag = tag_new();
int sample_rate = 44100; int sample_rate = 44100;
Music_Emu *emu; Music_Emu *emu;
gme_info_t *ti; gme_info_t *ti;
...@@ -96,6 +95,7 @@ gme_tag_dup(const char *path_fs) ...@@ -96,6 +95,7 @@ gme_tag_dup(const char *path_fs)
return NULL; return NULL;
} }
struct tag *tag = tag_new();
if(ti != NULL){ if(ti != NULL){
if(ti->length > 0) if(ti->length > 0)
tag->time = ti->length / 1000; tag->time = ti->length / 1000;
......
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