diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-28 02:19:22 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-28 02:19:22 +0200 |
commit | 9e13df3776da3a101e895e2840f6f23f5a6f74a0 (patch) | |
tree | dcd731f776e589447b1944036acbb37db495e0fe /libavformat | |
parent | 29f5c1e51b0d156f4650b96ab56c07727fe9a9b7 (diff) | |
download | ffmpeg-9e13df3776da3a101e895e2840f6f23f5a6f74a0.tar.gz |
avcodec/avcodec: Use avcodec_close() on avcodec_open2() failure
Compared to the earlier behaviour the following changes:
a) AVCodecInternal.byte_buffer is freed.
b) The last_pkt_props FIFO is emptied before freeing it.
c) If set AVCodecContext.hwaccel is uninitialized and its private data
is freed; hw_frames_ctx and hw_device_ctx are also unreferenced.
d) coded_side_data is freed.
e) active_thread_type is reset.
a), b), d) should be no-ops as the buffer/fifo should be empty and
no coded_side_data should exist at any point of avcodec_open2().
e) is obviously not bad.
c) is in accordance with the documentation of hw_(frames|device)_ctx
which states that libacodec takes over ownership of these references.
At least in the case of VC-1 it is possible for the hw acceleration to
be set during init and in this case freeing it actually fixes a memleak.
avcodec_close() needed only minor adjustments to make it work with
a potentially not fully initialized codec.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat')
0 files changed, 0 insertions, 0 deletions