changeset 2301:227de9a5467d

fix error pointed out by nenolod
author mf0102 <0102@gmx.at>
date Sat, 12 Jan 2008 16:35:26 +0100
parents fca4a63e086e
children f074702a0df3 5561e63e9133
files src/wav/wav-sndfile.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/wav/wav-sndfile.c	Sat Jan 12 16:26:05 2008 +0100
+++ b/src/wav/wav-sndfile.c	Sat Jan 12 16:35:26 2008 +0100
@@ -89,12 +89,17 @@
 static SNDFILE *
 open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo)
 {
+    SNDFILE *snd_file = NULL;
     vfsfile = aud_vfs_fopen(filename, "rb");
 
     if (vfsfile == NULL)
         return NULL;
 
-    return sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, vfsfile);
+    snd_file = sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, vfsfile);
+    if (snd_file == NULL)
+        aud_vfs_fclose(vfsfile);
+
+    return snd_file;
 }
 
 static void