]> git.sesse.net Git - ffmpeg/commit
avcodec/hevcdec: check that the local context list was allocated before dereferencing it
authorJames Almer <jamrial@gmail.com>
Wed, 10 Feb 2021 17:26:59 +0000 (14:26 -0300)
committerJames Almer <jamrial@gmail.com>
Thu, 11 Feb 2021 16:15:45 +0000 (13:15 -0300)
commit089706e009240ce3dc76f09ae9eee0ba98e65bd1
treeab6d236cbe6b09f9872f5fb702712744ec22e7ea
parent44facfb845563b3fc2a12cc3fbefc86ea72dea0b
avcodec/hevcdec: check that the local context list was allocated before dereferencing it

Since the decoder is not flagged as init cleanup capable, hevc_decode_free()
is being called manually if the hevc_decode_extradata() call fails at the end
of hevc_decode_init().
In a frame threading scenario, however, if AVCodec->init() returns an error,
ff_frame_thread_free() will be called regardless of the above flag being set
or not, resulting in hevc_decode_free() being called a second time for the
same context.

Workaround this by ensuring pointers are not dereferenced if they are NULL,
and set the decoder as init cleanup capable while at it.

Fixes ticket #9099.

Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/hevcdec.c