From 53c17db5e9184e26bd57356600f8fc259e94ca56 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Nov 2008 21:33:10 +0100 Subject: [PATCH] ogg: use ogg_fopen() instead of ogg_open() Move the reponsibility for freeing the file handle to libvorbis. --- src/decoder/oggvorbis_plugin.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c index 5aa777065..9fe381d25 100644 --- a/src/decoder/oggvorbis_plugin.c +++ b/src/decoder/oggvorbis_plugin.c @@ -327,17 +327,15 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream) static struct tag *oggvorbis_TagDup(const char *file) { + char *duplicated; + int err; struct tag *ret; - FILE *fp; OggVorbis_File vf; - fp = fopen(file, "r"); - if (!fp) { - return NULL; - } - - if (ov_open(fp, &vf, NULL, 0) < 0) { - fclose(fp); + duplicated = g_strdup(file); + err = ov_fopen(duplicated, &vf); + g_free(duplicated); + if (err < 0) return NULL; }