[FFmpeg-devel] [PATCH 1/2] avcodec/vp9: prevent null pointer use on init_frames() failure

Peter Ross pross at xvid.org
Sun Apr 5 09:31:55 EEST 2020


---
 libavcodec/vp9.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 7ee375d4d0..c125e22975 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1216,18 +1216,24 @@ static av_cold int vp9_decode_free(AVCodecContext *avctx)
     int i;
 
     for (i = 0; i < 3; i++) {
+        if (s->s.frames[i].tf.f) {
         if (s->s.frames[i].tf.f->buf[0])
             vp9_frame_unref(avctx, &s->s.frames[i]);
         av_frame_free(&s->s.frames[i].tf.f);
+        }
     }
     av_buffer_pool_uninit(&s->frame_extradata_pool);
     for (i = 0; i < 8; i++) {
+        if (s->s.refs[i].f) {
         if (s->s.refs[i].f->buf[0])
             ff_thread_release_buffer(avctx, &s->s.refs[i]);
         av_frame_free(&s->s.refs[i].f);
+        }
+        if (s->next_refs[i].f) {
         if (s->next_refs[i].f->buf[0])
             ff_thread_release_buffer(avctx, &s->next_refs[i]);
         av_frame_free(&s->next_refs[i].f);
+        }
     }
 
     free_buffers(s);
-- 
2.20.1

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200405/927dd502/attachment.sig>


More information about the ffmpeg-devel mailing list