song_save: free song object on error

Fix a minor memory leak.
This commit is contained in:
Max Kellermann 2009-11-01 17:51:32 +01:00
parent 4b17aca747
commit 5555d30bbd
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ song_load(FILE *fp, struct directory *parent, const char *uri,
} else if (0 == strncmp(SONG_MTIME, line, strlen(SONG_MTIME))) {
song->mtime = atoi(&(line[strlen(SONG_MTIME)]));
} else {
if (song->tag != NULL)
tag_end_add(song->tag);
song_free(song);
g_set_error(error_r, song_save_quark(), 0,
"unknown line in db: %s", line);
return false;