From: Anton Mitrofanov Date: Sun, 13 Feb 2011 20:19:13 +0000 (-0800) Subject: Fix memory leak on encoder close if not all frames are flushed X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=429af213842178f77ab33bbfc9f6b9cac56c7e7a;p=x264.git Fix memory leak on encoder close if not all frames are flushed --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 68a6fa16..eb64f57c 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -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;