aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/song.c2
-rw-r--r--src/song.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/song.c b/src/song.c
index c9301386d..03f65dd0d 100644
--- a/src/song.c
+++ b/src/song.c
@@ -37,7 +37,7 @@ static Song * song_alloc(const char *url, Directory *parent)
assert(url);
urllen = strlen(url);
assert(urllen);
- song = xmalloc(sizeof(Song) + urllen);
+ song = xmalloc(sizeof(*song) - sizeof(song->url) + urllen + 1);
song->tag = NULL;
memcpy(song->url, url, urllen + 1);
diff --git a/src/song.h b/src/song.h
index 9aa9efa94..58506280b 100644
--- a/src/song.h
+++ b/src/song.h
@@ -37,7 +37,7 @@ typedef struct _Song {
struct mpd_tag *tag;
struct _Directory *parentDir;
time_t mtime;
- char url[1];
+ char url[sizeof(size_t)];
} mpd_packed Song;
Song *newSong(const char *url, struct _Directory *parentDir);