diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-17 22:39:32 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-17 22:39:32 +0100 |
commit | 7a7b77e6c97aabb654414044a000e8c4e9d52575 (patch) | |
tree | 947e09bb5fa85d2baaa077682facfe33f48857d9 | |
parent | 3d5c0ba816b97d45ccba229ed1a0ff9d82952e1e (diff) | |
parent | 31dc73e92a96f08d07650c0e7d31c0b9a1465d46 (diff) | |
download | ffmpeg-7a7b77e6c97aabb654414044a000e8c4e9d52575.tar.gz |
Merge commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46'
* commit '31dc73e92a96f08d07650c0e7d31c0b9a1465d46':
vorbisdec: Check memory allocations
Conflicts:
libavcodec/vorbisdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-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 0953b969bb..d05a48a744 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -379,10 +379,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_array(used_entries, - codebook_setup->dimensions * - sizeof(*codebook_setup->codevectors)) - : NULL; + if (used_entries) { + codebook_setup->codevectors = + av_mallocz_array(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; |