aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-01 17:51:32 +0100
committerMax Kellermann <max@duempel.org>2009-11-01 17:51:32 +0100
commit5555d30bbd492be4241779578327a7fe3a7d99a1 (patch)
tree8e3c2b23b2b63e3fada427983a949ab3ba5e319d
parent4b17aca7476dacfbd3b3220ff8013724f5eed0c9 (diff)
downloadmpd-5555d30bbd492be4241779578327a7fe3a7d99a1.tar.gz
mpd-5555d30bbd492be4241779578327a7fe3a7d99a1.tar.xz
mpd-5555d30bbd492be4241779578327a7fe3a7d99a1.zip
song_save: free song object on error
Fix a minor memory leak.
-rw-r--r--src/song_save.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/song_save.c b/src/song_save.c
index 731d59e86..f13f1262e 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -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;