From 2234a1cd16680df7e15f5b8c44c3caadd22f5d25 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 22 Feb 2015 21:25:58 +0100 Subject: [PATCH] avcodec/vorbisdec: Fix memleak, call cleanup on memory allocation failure Fixes CID1258478, CID1258476, CID1258475 Signed-off-by: Michael Niedermayer --- libavcodec/vorbisdec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index d05a48a744..35eb2be0e1 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -383,8 +383,10 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) codebook_setup->codevectors = av_mallocz_array(used_entries, codebook_setup->dimensions * sizeof(*codebook_setup->codevectors)); - if (!codebook_setup->codevectors) - return AVERROR(ENOMEM); + if (!codebook_setup->codevectors) { + ret = AVERROR(ENOMEM); + goto error; + } } else codebook_setup->codevectors = NULL;