From ff06a92213c0d430f93552188cc569a5fa506e18 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 7 Sep 2008 13:37:33 +0200 Subject: playlist: fix FILE* leak in appendSongToStoredPlaylistByPath() When an error occurs after the file has been opened, the function will never close the FILE object. --- src/storedPlaylist.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/storedPlaylist.c') diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index b62ca42e4..ba0451f38 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -305,9 +305,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; -- cgit v1.2.3