From 275615da2613be69edb51c43d615de89981b3111 Mon Sep 17 00:00:00 2001 From: nadav78 Date: Thu, 16 Apr 2026 00:46:15 +0300 Subject: [PATCH 1/2] Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE --- src/raudio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/raudio.c b/src/raudio.c index 3cd6b37aa585..9ca5e9c7d96c 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -210,8 +210,11 @@ typedef struct tagBITMAPINFOHEADER { #endif #if SUPPORT_FILEFORMAT_OGG - // TODO: Remap stb_vorbis malloc()/free() calls to RL_MALLOC/RL_FREE + #define malloc RL_MALLOC + #define free RL_FREE #include "external/stb_vorbis.c" // OGG loading functions + #undef malloc + #undef free #endif #if SUPPORT_FILEFORMAT_MP3 From 42a7d818bd1bfa919368a01d695611352f34b6dd Mon Sep 17 00:00:00 2001 From: nadav78 Date: Thu, 16 Apr 2026 01:22:09 +0300 Subject: [PATCH 2/2] Remap stb_vorbis malloc/free calls to RL_MALLOC/RL_FREE Added STB_VORBIS_MALLOC and STB_VORBIS_FREE hooks to stb_vorbis.c, consistent with the named macro pattern used by dr_wav, dr_mp3, and qoa. --- src/external/stb_vorbis.c | 8 ++++++++ src/raudio.c | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/external/stb_vorbis.c b/src/external/stb_vorbis.c index 3e5c2504c08f..fb0e84845970 100644 --- a/src/external/stb_vorbis.c +++ b/src/external/stb_vorbis.c @@ -957,13 +957,21 @@ static void *setup_malloc(vorb *f, int sz) f->setup_offset += sz; return p; } + #ifdef STB_VORBIS_MALLOC + return sz ? STB_VORBIS_MALLOC(sz) : NULL; + #else return sz ? malloc(sz) : NULL; + #endif } static void setup_free(vorb *f, void *p) { if (f->alloc.alloc_buffer) return; // do nothing; setup mem is a stack + #ifdef STB_VORBIS_FREE + STB_VORBIS_FREE(p); + #else free(p); + #endif } static void *setup_temp_malloc(vorb *f, int sz) diff --git a/src/raudio.c b/src/raudio.c index 9ca5e9c7d96c..5c268c93b579 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -210,11 +210,9 @@ typedef struct tagBITMAPINFOHEADER { #endif #if SUPPORT_FILEFORMAT_OGG - #define malloc RL_MALLOC - #define free RL_FREE + #define STB_VORBIS_MALLOC RL_MALLOC + #define STB_VORBIS_FREE RL_FREE #include "external/stb_vorbis.c" // OGG loading functions - #undef malloc - #undef free #endif #if SUPPORT_FILEFORMAT_MP3