From 5e6fedd4eda070d4d9b23bc6818a85eaaefd3b46 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 28 Oct 2023 23:24:10 +0300
Subject: [PATCH] music_ogg.c: use a do-nothing close_func() in callbacks
earlier versions of libvorbis did not expect a NULL close_func and
segfault upon ov_clear(). same goes for the current lowmem branch
of tremor..
(cherry picked from commit fe33c67179e121481c1599c4ca9a4cf59a1dfefe)
---
load_ogg.c | 2 --
music_ogg.c | 7 +++++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/load_ogg.c b/load_ogg.c
index 2d0ee658..e1622f18 100644
--- a/load_ogg.c
+++ b/load_ogg.c
@@ -22,8 +22,6 @@
This file by Vaclav Slavik (vaclav.slavik@matfyz.cz).
*/
-/* $Id$ */
-
#ifdef OGG_MUSIC
#include <stdio.h>
diff --git a/music_ogg.c b/music_ogg.c
index a90ce3e0..0f401910 100644
--- a/music_ogg.c
+++ b/music_ogg.c
@@ -64,6 +64,12 @@ static long sdl_tell_func(void *datasource)
return SDL_RWtell((SDL_RWops*)datasource);
}
+static int sdl_close_func(void *datasource)
+{
+ (void) datasource;
+ return 0;
+}
+
/* Load an OGG stream from an SDL_RWops object */
OGG_music *OGG_new_RW(SDL_RWops *rw, int freerw)
{
@@ -80,6 +86,7 @@ OGG_music *OGG_new_RW(SDL_RWops *rw, int freerw)
SDL_memset(&callbacks, 0, sizeof(callbacks));
callbacks.read_func = sdl_read_func;
callbacks.seek_func = sdl_seek_func;
+ callbacks.close_func = sdl_close_func;
callbacks.tell_func = sdl_tell_func;
music = (OGG_music *)SDL_malloc(sizeof *music);