Skip to content

Commit

Permalink
Fix memory leak on encoder close if not all frames are flushed
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterNobody authored and Jason Garrett-Glaser committed Feb 18, 2011
1 parent 0926279 commit 429af21
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions encoder/encoder.c
Expand Up @@ -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;
Expand Down

0 comments on commit 429af21

Please sign in to comment.