[FFmpeg-devel] [PATCH 22/25] avcodec/utils: Also free encoder extradata on avcodec_open2() error
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Sat Sep 26 13:28:01 EEST 2020
It is owned by libavcodec for encoders.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/utils.c | 4 ++++
1 file changed, 4 insertions(+)
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);
--
2.25.1
More information about the ffmpeg-devel
mailing list