aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:37:33 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-09 00:55:39 -0700
commitff06a92213c0d430f93552188cc569a5fa506e18 (patch)
tree8d67f604c5e226b35104a8787187b6d2eec32e0b /src
parent99a7a9306b0fd9cf3587b8c0bc36258cac0d4ef6 (diff)
downloadmpd-ff06a92213c0d430f93552188cc569a5fa506e18.tar.gz
mpd-ff06a92213c0d430f93552188cc569a5fa506e18.tar.xz
mpd-ff06a92213c0d430f93552188cc569a5fa506e18.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 'src')
-rw-r--r--src/storedPlaylist.c2
1 files changed, 2 insertions, 0 deletions
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;