From e39616122c008ee817970bec66beea4a57c38663 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 21 Mar 2002 12:34:56 +0000 Subject: should fix a bug reported by Chris Rankin. (frame used after being freed) CVS patchset: 1603 CVS date: 2002/03/21 12:34:56 --- src/libmpeg2/decode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index d84c9d2f2..d7245afaa 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -182,7 +182,12 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->current_frame->pts = 0; mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); - picture->current_frame->free (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); + picture->current_frame = NULL; picture->throwaway_frame = NULL; } else if (picture->forward_reference_frame && !picture->forward_reference_frame->drawn) { -- cgit v1.2.3