diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-03-20 14:44:28 +0100 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-03-23 17:50:46 +0100 |
commit | 5ab506a5c83afe67ae0f0a8d7586764b54aeac27 (patch) | |
tree | 17d3baffe4570740754d1cdabcebe736a802a560 /libavcodec/mpegvideo.c | |
parent | 4a584edad7cd9be8241e8b6fe1fadf8340cd292b (diff) | |
download | ffmpeg-5ab506a5c83afe67ae0f0a8d7586764b54aeac27.tar.gz |
MPV: set reference frame pointers to NULL when allocation of dummy pictures fails
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 720997fb63..280207530b 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1267,8 +1267,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); s->last_picture_ptr = &s->picture[i]; - if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) + if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) { + s->last_picture_ptr = NULL; return -1; + } ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 0); ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 1); s->last_picture_ptr->f.reference = 3; @@ -1279,8 +1281,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); s->next_picture_ptr = &s->picture[i]; - if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) + if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) { + s->next_picture_ptr = NULL; return -1; + } ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 0); ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 1); s->next_picture_ptr->f.reference = 3; |