From 6fe053614c6973ae7edf92ef5f9c5bd901adfeeb Mon Sep 17 00:00:00 2001 From: "morlad (iLeitgeb)" Date: Fri, 12 Mar 2021 14:30:06 +0000 Subject: [PATCH] stb_vorbis: Fix memory leak in stb_vorbis When start_decoder() fails it may already have allocated memory for .vendor and/or .comment_list. Call vorbis_deinit() to free any allocated memory. Fixes issue #1051. --- stb_vorbis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index 8bf886b..0c7c18f 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -33,7 +33,7 @@ // Timur Gagiev Maxwell Koo Peter Waller // github:audinowho Dougall Johnson David Reid // github:Clownacy Pedro J. Estebanez Remi Verschelde -// AnthoFoxo +// AnthoFoxo github:morlat // // Partial history: // 1.21 - 2021-07-02 - fix bug for files with no comments @@ -4513,6 +4513,7 @@ stb_vorbis *stb_vorbis_open_pushdata( *error = VORBIS_need_more_data; else *error = p.error; + vorbis_deinit(&p); return NULL; } f = vorbis_alloc(&p);