summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-26 11:18:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-10-01 13:34:57 +0200
commitb8e0ceda11f7a12d763c6a744943347fc808b8b7 (patch)
tree77e8d585a6c3b00e003615dad070b9678d9003fe /libavcodec
parentd1dcc20126f3df52762bf5972a282d1699ef1ca8 (diff)
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 05064b560f..a976ceb260 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1034,11 +1034,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);