From 4882970b1c9be1c6b4d721fb18cec235093102e2 Mon Sep 17 00:00:00 2001 From: AnthoFoxo Date: Mon, 25 Jan 2021 20:01:42 -0500 Subject: [PATCH] vorbis comment list setup_malloc call is guarded --- stb_vorbis.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index ab77bc0..46f5370 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -3643,8 +3643,10 @@ static int start_decoder(vorb *f) f->vendor[len] = (char)'\0'; //user comments f->comment_list_length = get32_packet(f); - f->comment_list = (char**)setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == NULL && f->comment_list_length > 0) return error(f, VORBIS_outofmem); + f->comment_list = NULL; + if (f->comment_list_length > 0) + f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); + if (f->comment_list == NULL) return error(f, VORBIS_outofmem); for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f);