avcodec/h264: Clear delayed_pic on deallocation
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Dec 2014 20:27:37 +0000 (21:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 10 Jun 2015 00:13:07 +0000 (02:13 +0200)
Fixes use of freed memory

Fixes: case5_av_frame_copy_props.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e8714f6f93d1a32f4e4655209960afcf4c185214)

Conflicts:

libavcodec/h264.c

libavcodec/h264.c

index 5be363a..5f488b7 100644 (file)
@@ -1131,6 +1131,7 @@ static void free_tables(H264Context *h, int free_rbsp)
     av_buffer_pool_uninit(&h->ref_index_pool);
 
     if (free_rbsp && h->DPB) {
+        memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
         for (i = 0; i < MAX_PICTURE_COUNT; i++)
             unref_picture(h, &h->DPB[i]);
         av_freep(&h->DPB);