]> git.videolan.org Git - x264.git/commitdiff
Fix memory leak on encoder close if not all frames are flushed
authorAnton Mitrofanov <BugMaster@narod.ru>
Sun, 13 Feb 2011 20:19:13 +0000 (12:19 -0800)
committerJason Garrett-Glaser <jason@x264.com>
Fri, 18 Feb 2011 09:51:47 +0000 (01:51 -0800)
encoder/encoder.c

index 68a6fa167090fb8197596008d47a554608db3219..eb64f57cbd2d75abcf0f5b901f96bd6f722b5b01 100644 (file)
@@ -3318,6 +3318,12 @@ void    x264_encoder_close  ( x264_t *h )
 
     h = h->thread[0];
 
+    for( int i = 0; i < h->i_thread_frames; i++ )
+        if( h->thread[i]->b_thread_active )
+            for( int j = 0; j < h->thread[i]->i_ref[0]; j++ )
+                if( h->thread[i]->fref[0][j] && h->thread[i]->fref[0][j]->b_duplicate )
+                    x264_frame_delete( h->thread[i]->fref[0][j] );
+
     for( int i = h->param.i_threads - 1; i >= 0; i-- )
     {
         x264_frame_t **frame;