[FFmpeg-devel] [PATCH]Check for OOM in TTA decoder

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Apr 27 02:10:25 CEST 2011


Hi!

This should have been the first patch in the "8bit" mail.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index ece5c1c..4b2374d 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -287,7 +287,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
 
         s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
         s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx));
-        if (!s->ch_ctx)
+        if (!s->decode_buffer || !s->ch_ctx)
             return AVERROR(ENOMEM);
     } else {
         av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");


More information about the ffmpeg-devel mailing list