]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ffv1.c
lavf/segment: fix writing separate header with auto BSF
[ffmpeg] / libavcodec / ffv1.c
index 80a9434eb7eb74445d6cc09ecd24a491247341ff..a14dd2aab24594eee0ff7a33e5a3a40dbae798c1 100644 (file)
@@ -144,7 +144,11 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
 
         fs->sample_buffer = av_malloc_array((fs->width + 6), 3 * MAX_PLANES *
                                       sizeof(*fs->sample_buffer));
-        if (!fs->sample_buffer) {
+        fs->sample_buffer32 = av_malloc_array((fs->width + 6), 3 * MAX_PLANES *
+                                        sizeof(*fs->sample_buffer32));
+        if (!fs->sample_buffer || !fs->sample_buffer32) {
+            av_freep(&fs->sample_buffer);
+            av_freep(&fs->sample_buffer32);
             av_freep(&f->slice_context[i]);
             goto memfail;
         }
@@ -154,6 +158,7 @@ av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
 memfail:
     while(--i >= 0) {
         av_freep(&f->slice_context[i]->sample_buffer);
+        av_freep(&f->slice_context[i]->sample_buffer32);
         av_freep(&f->slice_context[i]);
     }
     return AVERROR(ENOMEM);
@@ -224,6 +229,7 @@ av_cold int ff_ffv1_close(AVCodecContext *avctx)
             av_freep(&p->vlc_state);
         }
         av_freep(&fs->sample_buffer);
+        av_freep(&fs->sample_buffer32);
     }
 
     av_freep(&avctx->stats_out);