[x264-devel] commit: Fix a valgrind warning in b-adapt 2 (Jason Garrett-Glaser )

git version control git at videolan.org
Mon Aug 31 23:27:15 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Aug 29 17:09:55 2009 -0700| [bfcb4f6c1d49505146be77cf57dcb72f0534907d] | committer: Jason Garrett-Glaser 

Fix a valgrind warning in b-adapt 2

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=bfcb4f6c1d49505146be77cf57dcb72f0534907d
---

 encoder/slicetype.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 634d726..ae1078e 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -767,10 +767,13 @@ static void x264_slicetype_analyse( x264_t *h, int keyframe )
             /* Perform the frametype analysis. */
             for( n = 2; n < num_frames-1; n++ )
                 x264_slicetype_path( h, &a, frames, n, max_bframes, num_frames-max_bframes, best_paths );
-            num_bframes = strspn( best_paths[num_frames-2], "B" );
-            /* Load the results of the analysis into the frame types. */
-            for( j = 1; j < num_frames; j++ )
-                frames[j]->i_type = best_paths[num_frames-2][j-1] == 'B' ? X264_TYPE_B : X264_TYPE_P;
+            if( num_frames > 1 )
+            {
+                num_bframes = strspn( best_paths[num_frames-2], "B" );
+                /* Load the results of the analysis into the frame types. */
+                for( j = 1; j < num_frames; j++ )
+                    frames[j]->i_type = best_paths[num_frames-2][j-1] == 'B' ? X264_TYPE_B : X264_TYPE_P;
+            }
             frames[num_frames]->i_type = X264_TYPE_P;
         }
         else if( h->param.i_bframe_adaptive == X264_B_ADAPT_FAST )



More information about the x264-devel mailing list