stored_playlist: don't close NULL file on error
spl_append_song() can crash when fopen() fails, because it attempts to close the invalid file handle (NULL) in the error handler.
This commit is contained in:
parent
85658965c9
commit
5ce625ea97
@ -379,12 +379,8 @@ spl_append_song(const char *utf8path, struct song *song)
|
|||||||
|
|
||||||
while (!(file = fopen(path_fs, "a")) && errno == EINTR);
|
while (!(file = fopen(path_fs, "a")) && errno == EINTR);
|
||||||
g_free(path_fs);
|
g_free(path_fs);
|
||||||
if (file == NULL) {
|
if (file == NULL)
|
||||||
int save_errno = errno;
|
|
||||||
while (fclose(file) != 0 && errno == EINTR);
|
|
||||||
errno = save_errno;
|
|
||||||
return PLAYLIST_RESULT_ERRNO;
|
return PLAYLIST_RESULT_ERRNO;
|
||||||
}
|
|
||||||
|
|
||||||
if (fstat(fileno(file), &st) < 0) {
|
if (fstat(fileno(file), &st) < 0) {
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user