From 25305d0fadd6343a55c61194dd195670c1616399 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 27 Mar 2002 02:47:26 +0000 Subject: fix frame buf leaks CVS patchset: 1639 CVS date: 2002/03/27 02:47:26 --- src/libmpeg2/decode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 866a7b1b0..4778fe55a 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -183,12 +183,14 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (picture->mpeg1) picture->current_frame->pts = 0; - mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); + if( !picture->current_frame->drawn ) + mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); picture->current_frame->drawn = 1; - /* frame must not be freed if we still have a copy of it */ - if( picture->current_frame != picture->backward_reference_frame ) - picture->current_frame->free (picture->current_frame); + if( picture->current_frame == picture->backward_reference_frame ) + picture->backward_reference_frame = NULL; + + picture->current_frame->free (picture->current_frame); picture->current_frame = NULL; picture->throwaway_frame = NULL; -- cgit v1.2.3