aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 3081dec4e..6d689c5c8 100644
--- a/src/song.c
+++ b/src/song.c
@@ -32,7 +32,7 @@ Song *
song_alloc(const char *url, enum song_type type, struct _Directory *parent)
{
size_t urllen = strlen(url);
- Song *song = xmalloc(sizeof(Song) + urllen);
+ Song *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 e2e74928b..c20bae270 100644
--- a/src/song.h
+++ b/src/song.h
@@ -40,7 +40,7 @@ typedef struct _Song {
struct tag *tag;
struct _Directory *parentDir;
time_t mtime;
- char url[1];
+ char url[sizeof(size_t)];
} mpd_packed Song;
Song *