aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-26 11:18:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-27 07:20:58 +0100
commit211f23d7897c48bb954e40134a6d6c3ac477b198 (patch)
tree6b882109a3fdb2f601447b1f38dc3a673d46839a
parent39d6d7f7e882f385d5b6e0dfe1acf9447ec467f1 (diff)
downloadffmpeg-211f23d7897c48bb954e40134a6d6c3ac477b198.tar.gz
avcodec/utils: Also free encoder extradata on avcodec_open2() error
It is owned by libavcodec for encoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit b8e0ceda11f7a12d763c6a744943347fc808b8b7)
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0f589b6929..81e34254e8 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1036,11 +1036,15 @@ free_and_end:
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
+ if (av_codec_is_encoder(avctx->codec)) {
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
av_frame_free(&avctx->coded_frame);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+ av_freep(&avctx->extradata);
+ avctx->extradata_size = 0;
+ }
av_dict_free(&tmp);
av_freep(&avctx->priv_data);