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

diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index af39c2d..85acc1c 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -259,9 +259,13 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
         }
 
         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)
+        if (!s->ch_ctx) {
+            av_freep(&s->decode_buffer);
             return AVERROR(ENOMEM);
+        }
     } else {
         av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
         return -1;
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to