SVN commit 726300 by hasso: Backport 726298. Don't leak file descriptors if fstat(2) fails for some reason. M +8 -2 localfile.cpp M +4 -1 mmapfile.cpp --- branches/kdesupport/3.5/kdesupport/akode/lib/localfile.cpp #726299:726300 @@ -58,7 +58,10 @@ struct stat stat; _fd = ::open(filename, O_RDONLY); - if (fstat(_fd, &stat) < 0) return false; + if (fstat(_fd, &stat) < 0) { + ::close(_fd); + return false; + } len = stat.st_size; m_readable = true; @@ -74,7 +77,10 @@ struct stat stat; _fd = ::open(filename, O_RDWR); - if (fstat(_fd, &stat) < 0) return false; + if (fstat(_fd, &stat) < 0) { + ::close(_fd); + return false; + } len = stat.st_size; m_readable = true; --- branches/kdesupport/3.5/kdesupport/akode/lib/mmapfile.cpp #726299:726300 @@ -58,7 +58,10 @@ struct stat stat; fd = ::open(filename, O_RDONLY); - if (fstat(fd, &stat) < 0) return false; + if (fstat(fd, &stat) < 0) { + ::close(fd); + return false; + } len = stat.st_size; pos = 0;