decoder/gme: allocate tag later, fixes memory leak

Allocate the "tag" object after the file has been opened successfully.
This commit is contained in:
Max Kellermann 2010-05-31 09:43:25 +02:00
parent 51c7577c8f
commit f0faf00320
1 changed files with 1 additions and 1 deletions

View File

@ -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)
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;