summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-06-07 18:56:48 +0200
committerRobin Gareus <robin@gareus.org>2013-06-07 18:56:48 +0200
commit676a23e0319970021963fcb0d4964e7d714de1ea (patch)
tree88fdc9fd68a972b9ecd65a2d06e8c31149301419 /libs
parent0761902b7ece5e422c3ddb7f79c775259521052a (diff)
close audio-file if it cannot be opened
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/sndfile_manager.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/pbd/sndfile_manager.cc b/libs/pbd/sndfile_manager.cc
index 982f028ddd..c3fbd7be5b 100644
--- a/libs/pbd/sndfile_manager.cc
+++ b/libs/pbd/sndfile_manager.cc
@@ -96,6 +96,10 @@ SndFileDescriptor::open ()
_sndfile = sf_open_fd (fd, _writeable ? SFM_RDWR : SFM_READ, _info, 1);
+ if (sf_open_fd == 0) {
+ ::close(fd);
+ }
+
return (_sndfile == 0);
}