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.
This commit is contained in:
morlad (iLeitgeb) 2021-03-12 14:30:06 +00:00 committed by Fabian Giesen
parent 2e3a6e8222
commit 6fe053614c

View File

@ -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);