summaryrefslogtreecommitdiff
path: root/libavcodec/tta.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-10 22:41:48 +0000
committerMichael Niedermayer <michaelni@gmx.at>2012-02-11 02:02:01 +0100
commitc6abf214923ae8ee07456c5594f632a10499442b (patch)
treeef28f650cafc876fe2e81544e23155ceac7e5b42 /libavcodec/tta.c
parenta697a185e475380b9cd9811e49aaee0a723a826c (diff)
tta: do not leak memory if bps == 3
In bps == 3 case output is decoded directly. Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tta.c')
-rw-r--r--libavcodec/tta.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index ab83730dfd..0e3bbd224c 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);