[FFmpeg-cvslog] tta: do not leak memory if bps == 3

Paul B Mahol git at videolan.org
Sat Feb 11 02:39:55 CET 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Feb 10 22:41:48 2012 +0000| [c6abf214923ae8ee07456c5594f632a10499442b] | committer: Michael Niedermayer

tta: do not leak memory if bps == 3

In bps == 3 case output is decoded directly.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6abf214923ae8ee07456c5594f632a10499442b
---

 libavcodec/tta.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index ab83730..0e3bbd2 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -279,9 +279,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
             return -1;
         }
 
-        s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
-        if (!s->decode_buffer)
-            return AVERROR(ENOMEM);
+        if (s->bps < 3) {
+            s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
+            if (!s->decode_buffer)
+                return AVERROR(ENOMEM);
+        }
         s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx));
         if (!s->ch_ctx) {
             av_freep(&s->decode_buffer);



More information about the ffmpeg-cvslog mailing list