]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/truemotion2.c
Merge commit '05b0998f511ffa699407465d48c7d5805f746ad2'
[ffmpeg] / libavcodec / truemotion2.c
index fba02f5a044438a8052146a90da0aff404001f6d..eacd728ca418ae59c2495e813b8570d71ea2983d 100644 (file)
@@ -888,6 +888,8 @@ static int decode_frame(AVCodecContext *avctx,
         t = tm2_read_stream(l, l->buffer + offset, tm2_stream_order[i],
                             buf_size - offset);
         if (t < 0) {
+            int j = tm2_stream_order[i];
+            memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
             return t;
         }
         offset += t;
@@ -932,15 +934,15 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     w += 8;
     h += 8;
-    l->Y1_base = av_malloc(sizeof(*l->Y1_base) * w * h);
-    l->Y2_base = av_malloc(sizeof(*l->Y2_base) * w * h);
+    l->Y1_base = av_mallocz(sizeof(*l->Y1_base) * w * h);
+    l->Y2_base = av_mallocz(sizeof(*l->Y2_base) * w * h);
     l->y_stride = w;
     w = (w + 1) >> 1;
     h = (h + 1) >> 1;
-    l->U1_base = av_malloc(sizeof(*l->U1_base) * w * h);
-    l->V1_base = av_malloc(sizeof(*l->V1_base) * w * h);
-    l->U2_base = av_malloc(sizeof(*l->U2_base) * w * h);
-    l->V2_base = av_malloc(sizeof(*l->V1_base) * w * h);
+    l->U1_base = av_mallocz(sizeof(*l->U1_base) * w * h);
+    l->V1_base = av_mallocz(sizeof(*l->V1_base) * w * h);
+    l->U2_base = av_mallocz(sizeof(*l->U2_base) * w * h);
+    l->V2_base = av_mallocz(sizeof(*l->V1_base) * w * h);
     l->uv_stride = w;
     l->cur = 0;
     if (!l->Y1_base || !l->Y2_base || !l->U1_base ||