From: Jason Garrett-Glaser Date: Thu, 31 Dec 2009 07:57:45 +0000 (-0500) Subject: Fix some invalid reads caught by valgrind X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=1b68cbd27b24759f64c72effdae42f184a20546e;p=x264.git Fix some invalid reads caught by valgrind Temporal predictor calculation was misled by invalid reference counts for I-frames. --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 6c57840d..5de6bdc0 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1339,8 +1339,11 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc ) int b_ok; /* build ref list 0/1 */ - h->i_ref0 = 0; - h->i_ref1 = 0; + h->mb.pic.i_fref[0] = h->i_ref0 = 0; + h->mb.pic.i_fref[1] = h->i_ref1 = 0; + if( h->sh.i_type == SLICE_TYPE_I ) + return; + for( i = 0; h->frames.reference[i]; i++ ) { if( h->frames.reference[i]->i_poc < i_poc )