summaryrefslogtreecommitdiff
path: root/src/libmpeg2/decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmpeg2/decode.c')
-rw-r--r--src/libmpeg2/decode.c7
1 files changed, 6 insertions, 1 deletions
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) {