aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-04-28 19:57:49 +0200
committerMax Kellermann <max@duempel.org>2009-04-28 19:57:49 +0200
commit7d9316a52d935ce6c9f4ae3030c975d660a02db6 (patch)
tree449de0693d30f16b0bb31980e8bc448efe71284a /src/song_save.c
parentfd09a3cf1f645e0156361f287bb8c64e4360981a (diff)
downloadmpd-7d9316a52d935ce6c9f4ae3030c975d660a02db6.tar.gz
mpd-7d9316a52d935ce6c9f4ae3030c975d660a02db6.tar.xz
mpd-7d9316a52d935ce6c9f4ae3030c975d660a02db6.zip
song_save: don't call tag_free(NULL)
When a song was in the database twice (which shouldn't happen), and the first song had no tag items, MPD calledd tag_free(NULL). Add a check to that source location, and an assertion to tag_free().
Diffstat (limited to '')
-rw-r--r--src/song_save.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/song_save.c b/src/song_save.c
index 1d2724e83..8f4e1614d 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -80,7 +80,8 @@ insertSongIntoList(struct songvec *sv, struct song *newsong)
tag_end_add(newsong->tag);
} else { /* prevent dupes, just update the existing song info */
if (existing->mtime != newsong->mtime) {
- tag_free(existing->tag);
+ if (existing->tag != NULL)
+ tag_free(existing->tag);
if (newsong->tag)
tag_end_add(newsong->tag);
existing->tag = newsong->tag;