diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-02-02 01:57:15 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-02-17 12:16:43 -0500 |
commit | 31dc73e92a96f08d07650c0e7d31c0b9a1465d46 (patch) | |
tree | 474f2f5ee84bf0718b4b7673696b89555d655bad | |
parent | ec17782e17de1e8501ca213e276dfe5412ff1d11 (diff) | |
download | ffmpeg-31dc73e92a96f08d07650c0e7d31c0b9a1465d46.tar.gz |
vorbisdec: Check memory allocations
-rw-r--r-- | libavcodec/vorbisdec.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index dbcc1cd911..d52bfd5d61 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -369,10 +369,15 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) } // Weed out unused vlcs and build codevector vector - codebook_setup->codevectors = used_entries ? av_mallocz(used_entries * - codebook_setup->dimensions * - sizeof(*codebook_setup->codevectors)) - : NULL; + if (used_entries) { + codebook_setup->codevectors = + av_mallocz(used_entries * codebook_setup->dimensions * + sizeof(*codebook_setup->codevectors)); + if (!codebook_setup->codevectors) + return AVERROR(ENOMEM); + } else + codebook_setup->codevectors = NULL; + for (j = 0, i = 0; i < entries; ++i) { unsigned dim = codebook_setup->dimensions; |