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

Peter Ross pross at xvid.org
Tue Apr 7 15:24:20 EEST 2020


Signed-off-by: Peter Ross <pross at xvid.org>
Reviewed-by: James Almer <jamrial at gmail.com>
---
 libavcodec/vp9.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 7ee375d4d0..2e6cd912a5 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -1216,17 +1216,14 @@ static av_cold int vp9_decode_free(AVCodecContext *avctx)
     int i;
 
     for (i = 0; i < 3; i++) {
-        if (s->s.frames[i].tf.f->buf[0])
-            vp9_frame_unref(avctx, &s->s.frames[i]);
+        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->buf[0])
-            ff_thread_release_buffer(avctx, &s->s.refs[i]);
+        ff_thread_release_buffer(avctx, &s->s.refs[i]);
         av_frame_free(&s->s.refs[i].f);
-        if (s->next_refs[i].f->buf[0])
-            ff_thread_release_buffer(avctx, &s->next_refs[i]);
+        ff_thread_release_buffer(avctx, &s->next_refs[i]);
         av_frame_free(&s->next_refs[i].f);
     }
 
-- 
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/20200407/be1f7671/attachment.sig>


More information about the ffmpeg-devel mailing list