Mercurial > audlegacy-plugins
changeset 2555:04b1b020be88
VFS file handle was not correctly closed and freed in certain situations,
causing a filehandle shortage and crash. Fixed, based on patch and report
by Teru KAMOGASHIRA.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 May 2008 22:16:12 +0300 |
parents | 8d09a4d017ea |
children | d26db7f08124 |
files | src/sndfile/plugin.c |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sndfile/plugin.c Thu May 08 22:07:03 2008 +0300 +++ b/src/sndfile/plugin.c Thu May 08 22:16:12 2008 +0300 @@ -95,17 +95,17 @@ static SNDFILE * -open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo) +open_sndfile_from_uri(gchar *filename, VFSFile **vfsfile, SF_INFO *tmp_sfinfo) { SNDFILE *snd_file = NULL; - vfsfile = aud_vfs_fopen(filename, "rb"); + *vfsfile = aud_vfs_fopen(filename, "rb"); - if (vfsfile == NULL) + if (*vfsfile == NULL) return NULL; - snd_file = 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); + aud_vfs_fclose(*vfsfile); return snd_file; } @@ -143,7 +143,7 @@ gboolean lossy = FALSE; gchar *codec, *format, *subformat; - tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); + tmp_sndfile = open_sndfile_from_uri(filename, &vfsfile, &tmp_sfinfo); if ( sf_get_string(tmp_sndfile, SF_STR_TITLE) == NULL) aud_tuple_associate_string(ti, FIELD_TITLE, NULL, g_path_get_basename(filename)); else @@ -351,7 +351,7 @@ SF_INFO tmp_sfinfo; /* Have to open the file to see if libsndfile can handle it. */ - tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); + tmp_sndfile = open_sndfile_from_uri(filename, &vfsfile, &tmp_sfinfo); if (!tmp_sndfile) return FALSE; @@ -446,7 +446,7 @@ pcmbitwidth = 32; song_title = get_title(playback->filename); - sndfile = open_sndfile_from_uri(playback->filename, vfsfile, &sfinfo); + sndfile = open_sndfile_from_uri(playback->filename, &vfsfile, &sfinfo); if (!sndfile) return;