Browse Source

h264: clear the ref lists when the reference are cleared.

Fixes reading of freed arrays (Ticket1498)

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer 12 years ago
parent
commit
87b9868972
1 changed files with 3 additions and 0 deletions
  1. 3 0
      libavcodec/h264_refs.c

+ 3 - 0
libavcodec/h264_refs.c

@@ -443,6 +443,9 @@ void ff_h264_remove_all_refs(H264Context *h){
         h->short_ref[i]= NULL;
     }
     h->short_ref_count=0;
+
+    memset(h->default_ref_list, 0, sizeof(h->default_ref_list));
+    memset(h->ref_list, 0, sizeof(h->ref_list));
 }
 
 /**