diff options
author | Max Kellermann <max@duempel.org> | 2008-09-07 13:37:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-07 13:37:33 +0200 |
commit | d1df71ebbcb23456ca5985dea9cb06e2453f903e (patch) | |
tree | 50a5ec6ee6e4d944e6ee1cf431c87157815e4f1d /src/storedPlaylist.c | |
parent | 54c8e3daafd2e85316662beae2ee78f6d0b0df44 (diff) | |
download | mpd-d1df71ebbcb23456ca5985dea9cb06e2453f903e.tar.gz mpd-d1df71ebbcb23456ca5985dea9cb06e2453f903e.tar.xz mpd-d1df71ebbcb23456ca5985dea9cb06e2453f903e.zip |
playlist: fix FILE* leak in appendSongToStoredPlaylistByPath()
When an error occurs after the file has been opened, the function will
never close the FILE object.
Diffstat (limited to '')
-rw-r--r-- | src/storedPlaylist.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index b806ecf0b..46a0ce3ca 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -301,9 +301,11 @@ int appendSongToStoredPlaylistByPath(int fd, const char *utf8path, Song *song) if (fstat(fileno(file), &st) < 0) { commandError(fd, ACK_ERROR_NO_EXIST, "could not stat file " "\"%s\": %s", path_max_tmp, strerror(errno)); + while (fclose(file) != 0 && errno == EINTR); return -1; } if (st.st_size >= ((MPD_PATH_MAX+1) * playlist_max_length)) { + while (fclose(file) != 0 && errno == EINTR); commandError(fd, ACK_ERROR_PLAYLIST_MAX, "playlist is at the max size"); return -1; |