[FFmpeg-cvslog] avcodec/utils: Improve check for freeing codec private options

Andreas Rheinhardt git at videolan.org
Thu Oct 1 15:13:45 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Sep 24 23:41:24 2020 +0200| [c6e54d14c55221b7380a0e86d7a42b60ff9e5eeb] | committer: Andreas Rheinhardt

avcodec/utils: Improve check for freeing codec private options

Don't check for AVCodec.priv_data_size (which is always true if
AVCodec.priv_class is set). Instead check for AVCodecContext.priv_data
to actually exist.

(Note: av_opt_free(NULL) is a no-op.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6e54d14c55221b7380a0e86d7a42b60ff9e5eeb
---

 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8e7c3125aa..a8af45d0c3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1030,7 +1030,7 @@ free_and_end:
     if (HAVE_THREADS && avci->thread_ctx)
         ff_thread_free(avctx);
 
-    if (codec->priv_class && codec->priv_data_size)
+    if (codec->priv_class && avctx->priv_data)
         av_opt_free(avctx->priv_data);
     av_opt_free(avctx);
 



More information about the ffmpeg-cvslog mailing list