playlist: fix FILE* leak in appendSongToStoredPlaylistByPath()
When an error occurs after the file has been opened, the function will never close the FILE object.
This commit is contained in:
parent
54c8e3daaf
commit
d1df71ebbc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user