changeset 12348:97a9ea928ffc libavcodec

vorbisdec: Return AVERROR(ENOMEM) on malloc() failure. This is especially important because classifs can be very large.
author alexc
date Tue, 03 Aug 2010 00:27:54 +0000
parents bc21b45eba99
children f618c62a6ddb
files vorbis_dec.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_dec.c	Tue Aug 03 00:25:06 2010 +0000
+++ b/vorbis_dec.c	Tue Aug 03 00:27:54 2010 +0000
@@ -667,6 +667,8 @@
         res_setup->classifs = av_malloc(res_setup->ptns_to_read *
                                         vc->audio_channels *
                                         sizeof(*res_setup->classifs));
+        if (!res_setup->classifs)
+            return AVERROR(ENOMEM);
 
         AV_DEBUG("    begin %d end %d part.size %d classif.s %d classbook %d \n", res_setup->begin, res_setup->end, res_setup->partition_size,
           res_setup->classifications, res_setup->classbook);